- Added automatic adjustment to the screen

git-svn-id: svn://kolibrios.org@9124 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-08-06 18:40:39 +00:00
parent 8835a95cf8
commit 0077b41b33
2 changed files with 37 additions and 0 deletions

View File

@ -113,6 +113,7 @@ ksys_pos_t _ksys_screen_size()
"int $0x40"
:"=a"(size_tmp)
:"a"(14)
:"memory"
);
size.x = size_tmp.y;
size.y = size_tmp.x;
@ -206,6 +207,39 @@ void setcwd(char* path){
asm_inline(
"int $0x40"
::"a"(30), "b"(1), "c"(path)
:"memory"
);
}
extern unsigned screenWidth;
extern unsigned screenHeight;
void kolibri_set_win_max(void){
unsigned multip1, multip2;
ksys_pos_t screen_size = _ksys_screen_size();
screen_size.y++;
screen_size.x++;
multip1 = (screen_size.y)/240;
multip2 = (screen_size.y)/200;
do{
screenWidth = 320 * multip1;
screenHeight = 240 * multip1;
if(screenWidth<=screen_size.x){
break;
}
screenWidth = 320 * multip2;
screenHeight = 200 * multip2;
if(screenWidth<=screen_size.y){
break;
}
multip1--;
multip2--;
}while(multip1>0 && multip2>0);
}

View File

@ -1965,10 +1965,13 @@ void CheckParameters(int argc, char *argv[])
==========================
*/
extern void kolibri_set_win_max(void);
int main (int argc, char *argv[])
{
#ifdef _KOLIBRI
setcwd(dirname(argv[0]));
kolibri_set_win_max();
#endif
#if defined(_arch_dreamcast)