ANSI emulation is activated for the session when an escape sequence is encountered other than those used by internal messages. Fixes LucasArts setup programs (Bug #458) provided that ANSI emulation is not activated.
Compatible scroll fill for ANSI emulation. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4097
This commit is contained in:
parent
c7ced14d56
commit
630b9befb5
4 changed files with 28 additions and 9 deletions
|
@ -627,6 +627,7 @@ struct DOS_Block {
|
|||
bool breakcheck;
|
||||
bool echo; // if set to true dev_con::read will echo input
|
||||
bool direct_output;
|
||||
bool internal_output;
|
||||
struct {
|
||||
RealPt mediaid;
|
||||
RealPt tempdta;
|
||||
|
|
|
@ -30,11 +30,12 @@ public:
|
|||
bool Write(Bit8u * data,Bit16u * size);
|
||||
bool Seek(Bit32u * pos,Bit32u type);
|
||||
bool Close();
|
||||
void ClearAnsi(void);
|
||||
Bit16u GetInformation(void);
|
||||
bool ReadFromControlChannel(PhysPt bufptr,Bit16u size,Bit16u * retcode){return false;}
|
||||
bool WriteToControlChannel(PhysPt bufptr,Bit16u size,Bit16u * retcode){return false;}
|
||||
private:
|
||||
void ClearAnsi(void);
|
||||
void Output(Bit8u chr);
|
||||
Bit8u readcache;
|
||||
Bit8u lastwrite;
|
||||
struct ansi { /* should create a constructor, which would fill them with the appropriate values */
|
||||
|
@ -132,18 +133,15 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
|||
/* expand tab if not direct output */
|
||||
page = real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
|
||||
do {
|
||||
INT10_TeletypeOutputAttr(' ',ansi.enabled?ansi.attr:7,true);
|
||||
Output(' ');
|
||||
col=CURSOR_POS_COL(page);
|
||||
} while(col%8);
|
||||
lastwrite = data[count++];
|
||||
continue;
|
||||
} else {
|
||||
/* Some sort of "hack" now that '\n' doesn't set col to 0 (int10_char.cpp old chessgame) */
|
||||
if((data[count] == '\n') && (lastwrite != '\r')) {
|
||||
INT10_TeletypeOutputAttr('\r',ansi.enabled?ansi.attr:7,true);
|
||||
}
|
||||
/* use ansi attribute if ansi is enabled, otherwise use DOS default attribute*/
|
||||
INT10_TeletypeOutputAttr(data[count],ansi.enabled?ansi.attr:7,true);
|
||||
if((data[count] == '\n') && (lastwrite != '\r')) Output('\r');
|
||||
Output(data[count]);
|
||||
lastwrite = data[count++];
|
||||
continue;
|
||||
}
|
||||
|
@ -168,6 +166,7 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
|||
continue;
|
||||
}
|
||||
/*ansi.esc and ansi.sci are true */
|
||||
if (!dos.internal_output) ansi.enabled=true;
|
||||
page = real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
|
||||
switch(data[count]){
|
||||
case '0':
|
||||
|
@ -187,11 +186,9 @@ bool device_CON::Write(Bit8u * data,Bit16u * size) {
|
|||
break;
|
||||
case 'm': /* SGR */
|
||||
for(i=0;i<=ansi.numberofarg;i++){
|
||||
ansi.enabled=true;
|
||||
switch(ansi.data[i]){
|
||||
case 0: /* normal */
|
||||
ansi.attr=0x07;//Real ansi does this as well. (should do current defaults)
|
||||
ansi.enabled=false;
|
||||
break;
|
||||
case 1: /* bold mode on*/
|
||||
ansi.attr|=0x08;
|
||||
|
@ -429,3 +426,19 @@ void device_CON::ClearAnsi(void){
|
|||
ansi.sci=false;
|
||||
ansi.numberofarg=0;
|
||||
}
|
||||
|
||||
void device_CON::Output(Bit8u chr) {
|
||||
if (dos.internal_output || ansi.enabled) {
|
||||
if (CurMode->type==M_TEXT) {
|
||||
Bit8u page=real_readb(BIOSMEM_SEG,BIOSMEM_CURRENT_PAGE);
|
||||
Bit8u col=CURSOR_POS_COL(page);
|
||||
Bit8u row=CURSOR_POS_ROW(page);
|
||||
BIOS_NCOLS;BIOS_NROWS;
|
||||
if (nrows==row+1 && (chr=='\n' || (ncols==col+1 && chr!='\r' && chr!=8 && chr!=7))) {
|
||||
INT10_ScrollWindow(0,0,(Bit8u)(nrows-1),(Bit8u)(ncols-1),-1,ansi.attr,page);
|
||||
INT10_SetCursorPos(row-1,col,page);
|
||||
}
|
||||
}
|
||||
INT10_TeletypeOutputAttr(chr,ansi.attr,true);
|
||||
} else INT10_TeletypeOutput(chr,7);
|
||||
}
|
||||
|
|
|
@ -1240,6 +1240,7 @@ public:
|
|||
dos.version.major=5;
|
||||
dos.version.minor=0;
|
||||
dos.direct_output=false;
|
||||
dos.internal_output=false;
|
||||
}
|
||||
~DOS(){
|
||||
for (Bit16u i=0;i<DOS_DRIVES;i++) delete Drives[i];
|
||||
|
|
|
@ -138,6 +138,7 @@ void Program::WriteOut(const char * format,...) {
|
|||
va_end(msg);
|
||||
|
||||
Bit16u size = (Bit16u)strlen(buf);
|
||||
dos.internal_output=true;
|
||||
for(Bit16u i = 0; i < size;i++) {
|
||||
Bit8u out;Bit16u s=1;
|
||||
if (buf[i] == 0xA && last_written_character != 0xD) {
|
||||
|
@ -146,6 +147,7 @@ void Program::WriteOut(const char * format,...) {
|
|||
last_written_character = out = buf[i];
|
||||
DOS_WriteFile(STDOUT,&out,&s);
|
||||
}
|
||||
dos.internal_output=false;
|
||||
|
||||
// DOS_WriteFile(STDOUT,(Bit8u *)buf,&size);
|
||||
}
|
||||
|
@ -153,6 +155,7 @@ void Program::WriteOut(const char * format,...) {
|
|||
void Program::WriteOut_NoParsing(const char * format) {
|
||||
Bit16u size = (Bit16u)strlen(format);
|
||||
char const* buf = format;
|
||||
dos.internal_output=true;
|
||||
for(Bit16u i = 0; i < size;i++) {
|
||||
Bit8u out;Bit16u s=1;
|
||||
if (buf[i] == 0xA && last_written_character != 0xD) {
|
||||
|
@ -161,6 +164,7 @@ void Program::WriteOut_NoParsing(const char * format) {
|
|||
last_written_character = out = buf[i];
|
||||
DOS_WriteFile(STDOUT,&out,&s);
|
||||
}
|
||||
dos.internal_output=false;
|
||||
|
||||
// DOS_WriteFile(STDOUT,(Bit8u *)format,&size);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue