Fix many bugs introduced by the gp2x "hack" of not having a windowed mode.

Still not working perfectly, but at least i can manage to get the program in 320x240 by default on gp2x, without modifying the config files.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@856 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-06-11 16:19:45 +00:00
parent 92b5727994
commit 8987f07c8a
5 changed files with 38 additions and 13 deletions

View File

@ -1506,7 +1506,7 @@ void Button_Resolution(void)
default: // Boutons de tag des états des modes
temp=list_start+clicked_button-8;
if (temp && // On n'a pas le droit de cocher le mode fenêtré
if (Video_mode[temp].Fullscreen==1 && // On n'a pas le droit de cocher le mode fenêtré
!(Video_mode[temp].State & 128)) // Ni ceux non détectés par SDL
{
if (Window_attribute1==LEFT_SIDE)

BIN
gfx2.cfg

Binary file not shown.

29
init.c
View File

@ -1671,7 +1671,13 @@ void Set_all_video_modes(void)
for (index=0; Modes[index]; index++)
{
int index2;
for (index2=1; index2 < Nb_video_modes; index2++)
#if defined(__GP2X__)
// On the GP2X the first mode is not windowed, so include it in the search.
index2=0;
#else
index2=1;
#endif
for (/**/; index2 < Nb_video_modes; index2++)
if (Modes[index]->w == Video_mode[index2].Width &&
Modes[index]->h == Video_mode[index2].Height)
{
@ -1813,7 +1819,12 @@ int Load_CFG(int reload_all)
!Read_word_le(Handle, &cfg_video_mode.Height) )
goto Erreur_lecture_config;
for (index2=1; index2<Nb_video_modes; index2++)
#if defined(__GP2X__)
index2=0;
#else
index2=1;
#endif
for (/**/; index2<Nb_video_modes; index2++)
{
if (Video_mode[index2].Width==cfg_video_mode.Width &&
Video_mode[index2].Height==cfg_video_mode.Height)
@ -2044,7 +2055,12 @@ int Save_CFG(void)
// D'abord compter les modes pour lesquels l'utilisateur a mis une préférence
modes_to_save=0;
for (index=1; index<Nb_video_modes; index++)
#if defined(__GP2X__)
index = 0;
#else
index = 1;
#endif
for (/**/; index<Nb_video_modes; index++)
if (Video_mode[index].State==0 || Video_mode[index].State==2 || Video_mode[index].State==3)
modes_to_save++;
@ -2055,7 +2071,12 @@ int Save_CFG(void)
if (!Write_byte(Handle, Chunk.Number) ||
!Write_word_le(Handle, Chunk.Size) )
goto Erreur_sauvegarde_config;
for (index=1; index<Nb_video_modes; index++)
#if defined(__GP2X__)
index = 0;
#else
index = 1;
#endif
for (/**/; index<Nb_video_modes; index++)
if (Video_mode[index].State==0 || Video_mode[index].State==2 || Video_mode[index].State==3)
{
cfg_video_mode.State =Video_mode[index].State;

2
misc.c
View File

@ -798,7 +798,7 @@ int Convert_videomode_arg(const char *argument)
int mode_index;
for (mode_index=0; mode_index<Nb_video_modes; mode_index++)
// Attention les vieilles fonctions de lecture .ini mettent tout en MAJUSCULE.
if (!strcasecmp(Mode_label(mode_index), argument))
if (!strcasecmp(Mode_label(mode_index), argument) && (Video_mode[mode_index].State &128) ==0)
return mode_index;
return -1;

View File

@ -713,14 +713,18 @@ int Load_INI(T_Config * conf)
}
// Optionnel, les dimensions de la fenêtre (à partir de beta 97.0%)
Video_mode[0].Width = 640;
Video_mode[0].Height = 480;
if (!Load_INI_get_values (file,buffer,"Default_window_size",2,values))
// Do that only if the first mode is actually windowed (not the case on gp2x for example)
if(Video_mode[0].Fullscreen==0)
{
if ((values[0]>=320))
Video_mode[0].Width = values[0];
if ((values[1]>=200))
Video_mode[0].Height = values[1];
Video_mode[0].Width = 640;
Video_mode[0].Height = 480;
if (!Load_INI_get_values (file,buffer,"Default_window_size",2,values))
{
if ((values[0]>=320))
Video_mode[0].Width = values[0];
if ((values[1]>=200))
Video_mode[0].Height = values[1];
}
}
conf->Mouse_merge_movement=100;