From a80af90142526d5b026a89fdbac205e93e19d25a Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Tue, 1 Mar 2011 19:27:34 +0000 Subject: Implemented OS detection routines provided by GS svn path=/trunk/netsurf/; revision=11873 --- atari/osspec.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 4 deletions(-) (limited to 'atari/osspec.c') diff --git a/atari/osspec.c b/atari/osspec.c index 97b518757..498b12678 100644 --- a/atari/osspec.c +++ b/atari/osspec.c @@ -13,11 +13,52 @@ NS_ATARI_SYSINFO atari_sysinfo; +unsigned short _systype_v; +unsigned short _systype (void) +{ +_systype_v = (_systype_v & ~0xF) | SYS_MINT | SYS_XAAES; + return _systype_v; + + int32_t * cptr = NULL; + _systype_v = SYS_TOS; + + cptr = Setexc(0x0168, -1L); + if (cptr == NULL ) { + return _systype_v; /* stone old TOS without any cookie support */ + } + while (*cptr) { + if (*cptr == C_MgMc || *cptr == C_MgMx ) { + _systype_v = (_systype_v & ~0xF) | SYS_MAGIC; + } else if (*cptr == C_MiNT ) { + _systype_v = (_systype_v & ~0xF) | SYS_MINT; + } else if (*cptr == C_Gnva/*Gnva*/) { + _systype_v |= SYS_GENEVA; + } else if (*cptr == C_nAES/*nAES*/) { + _systype_v |= SYS_NAES; + } + cptr += 2; + } + if (_systype_v & SYS_MINT) { /* check for XaAES */ + short out = 0, u; + if (wind_get (0, (((short)'X') <<8)|'A', &out, &u,&u,&u) && out) { + _systype_v |= SYS_XAAES; + } + } + return _systype_v; +} void init_os_info(void) { int16_t out[4]; - atari_sysinfo.gdosversion = Sversion(); + unsigned long cookie_FSMC = 0; + + atari_sysinfo.gemdos_version = Sversion(); + + if( tos_getcookie (C_FSMC, &cookie_FSMC ) == C_FOUND ) { + atari_sysinfo.gdos_FSMC = 1; + } else { + atari_sysinfo.gdos_FSMC = 0; + } atari_sysinfo.large_sfont_pxh = 13; atari_sysinfo.medium_sfont_pxh = 6; atari_sysinfo.small_sfont_pxh = 4; @@ -28,6 +69,15 @@ void init_os_info(void) } if( appl_xgetinfo(AES_SMALLFONT, &out[0], &out[1], &out[2], &out[3] ) > 0 ){ atari_sysinfo.small_sfont_pxh = out[0]; + } + atari_sysinfo.aes_max_win_title_len = 79; + if (sys_type() & (SYS_MAGIC|SYS_NAES|SYS_XAAES)) { + if (sys_NAES()) { + atari_sysinfo.aes_max_win_title_len = 127; + } + if (sys_XAAES()) { + atari_sysinfo.aes_max_win_title_len = 200; + } } } @@ -36,7 +86,7 @@ int tos_getcookie(long tag, long * value) COOKIE * cptr; long oldsp; - if( atari_sysinfo.gdosversion > TOS4VER ){ + if( atari_sysinfo.gemdos_version > TOS4VER ){ return( Getcookie(tag, value) ); } @@ -45,7 +95,9 @@ int tos_getcookie(long tag, long * value) do { if( cptr->c == tag ){ if(cptr->v != 0 ){ - *value = cptr->v; + if( value != NULL ){ + *value = cptr->v; + } return( C_FOUND ); } } @@ -86,7 +138,7 @@ char * gdos_realpath(const char * path, char * rpath) if( rpath == NULL ){ return( NULL ); } - if( atari_sysinfo.gdosversion > TOS4VER ){ + if( sys_type() & SYS_MINT ){ return( realpath(path, rpath) ); } -- cgit v1.2.3