Remove DisplayOption and set fullscreen

This commit is contained in:
simon.kagstrom 2010-02-28 14:09:31 +00:00
parent bc9dc61786
commit 6e43635fa8
7 changed files with 28 additions and 44 deletions

View File

@ -138,6 +138,7 @@ int init_graphics(void)
{ {
Uint32 rmask, gmask, bmask, amask; Uint32 rmask, gmask, bmask, amask;
const SDL_VideoInfo *info = SDL_GetVideoInfo(); const SDL_VideoInfo *info = SDL_GetVideoInfo();
Uint32 flags = SDL_DOUBLEBUF;
/* SDL interprets each pixel as a 32-bit number, so our masks must depend /* SDL interprets each pixel as a 32-bit number, so our masks must depend
on the endianness (byte order) of the machine */ on the endianness (byte order) of the machine */
@ -156,6 +157,7 @@ int init_graphics(void)
// Open window // Open window
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
SDL_FreeSurface(sdl_screen);
sdl_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, DISPLAY_X, DISPLAY_Y + 17, 8, sdl_screen = SDL_CreateRGBSurface(SDL_SWSURFACE, DISPLAY_X, DISPLAY_Y + 17, 8,
rmask, gmask, bmask, amask); rmask, gmask, bmask, amask);
if (!sdl_screen) if (!sdl_screen)
@ -164,14 +166,19 @@ int init_graphics(void)
SDL_GetError()); SDL_GetError());
exit(1); exit(1);
} }
if (ThePrefs.DisplayType == DISPTYPE_SCREEN)
flags |= SDL_FULLSCREEN;
screen_bits_per_pixel = info->vfmt->BitsPerPixel; screen_bits_per_pixel = info->vfmt->BitsPerPixel;
SDL_FreeSurface(real_screen);
real_screen = SDL_SetVideoMode(FULL_DISPLAY_X, FULL_DISPLAY_Y, screen_bits_per_pixel, real_screen = SDL_SetVideoMode(FULL_DISPLAY_X, FULL_DISPLAY_Y, screen_bits_per_pixel,
SDL_DOUBLEBUF); flags);
if (!real_screen) if (!real_screen)
{ {
fprintf(stderr, "\n\nCannot initialize video: %s\n", SDL_GetError()); fprintf(stderr, "\n\nCannot initialize video: %s\n", SDL_GetError());
exit(1); exit(1);
} }
free(screen_16);
free(screen_32);
switch (screen_bits_per_pixel) switch (screen_bits_per_pixel)
{ {
@ -337,7 +344,7 @@ void C64Display::Update_stretched(uint8 *src_pixels)
void C64Display::Update(uint8 *src_pixels) void C64Display::Update(uint8 *src_pixels)
{ {
if (ThePrefs.DisplayOption != 0) if (0)
this->Update_stretched(src_pixels); this->Update_stretched(src_pixels);
else else
{ {

View File

@ -111,10 +111,7 @@ Prefs::Prefs()
this->SetupJoystickDefaults(); this->SetupJoystickDefaults();
#ifdef HAVE_SDL
this->DisplayOption = 0;
this->MsPerFrame = SPEED_100; this->MsPerFrame = SPEED_100;
#endif
this->NetworkKey = rand() % 0xffff; this->NetworkKey = rand() % 0xffff;
this->NetworkAvatar = 0; this->NetworkAvatar = 0;
snprintf(this->NetworkName, 32, "Unset name"); snprintf(this->NetworkName, 32, "Unset name");
@ -292,10 +289,7 @@ bool Prefs::operator==(const Prefs &rhs) const
&& AlwaysCopy == rhs.AlwaysCopy && AlwaysCopy == rhs.AlwaysCopy
&& SystemKeys == rhs.SystemKeys && SystemKeys == rhs.SystemKeys
&& ShowLEDs == rhs.ShowLEDs && ShowLEDs == rhs.ShowLEDs
#ifdef HAVE_SDL
&& this->DisplayOption == rhs.DisplayOption
&& this->MsPerFrame == rhs.MsPerFrame && this->MsPerFrame == rhs.MsPerFrame
#endif
&& this->NetworkKey == rhs.NetworkKey && this->NetworkKey == rhs.NetworkKey
&& this->NetworkPort == rhs.NetworkPort && this->NetworkPort == rhs.NetworkPort
&& this->NetworkRegion == rhs.NetworkRegion && this->NetworkRegion == rhs.NetworkRegion
@ -469,8 +463,6 @@ void Prefs::Load(const char *filename)
if (n >= 0 && n < MAX_JOYSTICK_BUTTONS) if (n >= 0 && n < MAX_JOYSTICK_BUTTONS)
this->MenuJoystickButtons[n] = atoi(value); this->MenuJoystickButtons[n] = atoi(value);
} }
else if (!strcmp(keyword, "DisplayOption"))
DisplayOption = atoi(value);
else if (!strcmp(keyword, "MsPerFrame")) else if (!strcmp(keyword, "MsPerFrame"))
MsPerFrame = atoi(value); MsPerFrame = atoi(value);
else if (!strcmp(keyword, "NetworkKey")) else if (!strcmp(keyword, "NetworkKey"))
@ -591,7 +583,6 @@ bool Prefs::Save(const char *filename)
maybe_write(file, MenuJoystickButtons[i] != TheDefaultPrefs.MenuJoystickButtons[i], "MenuJoystickButtons%d = %d\n", i, MenuJoystickButtons[i]); maybe_write(file, MenuJoystickButtons[i] != TheDefaultPrefs.MenuJoystickButtons[i], "MenuJoystickButtons%d = %d\n", i, MenuJoystickButtons[i]);
} }
maybe_write(file, DisplayOption != TheDefaultPrefs.DisplayOption, "DisplayOption = %d\n", DisplayOption);
maybe_write(file, MsPerFrame != TheDefaultPrefs.MsPerFrame, "MsPerFrame = %d\n", MsPerFrame); maybe_write(file, MsPerFrame != TheDefaultPrefs.MsPerFrame, "MsPerFrame = %d\n", MsPerFrame);
maybe_write(file, NetworkKey != TheDefaultPrefs.NetworkKey, "NetworkKey = %d\n", NetworkKey); maybe_write(file, NetworkKey != TheDefaultPrefs.NetworkKey, "NetworkKey = %d\n", NetworkKey);
maybe_write(file, NetworkAvatar != TheDefaultPrefs.NetworkAvatar, "NetworkAvatar = %d\n", NetworkAvatar); maybe_write(file, NetworkAvatar != TheDefaultPrefs.NetworkAvatar, "NetworkAvatar = %d\n", NetworkAvatar);

View File

@ -155,29 +155,8 @@ public:
bool SystemKeys; // Enable system keys and menu keys (Win32) bool SystemKeys; // Enable system keys and menu keys (Win32)
bool ShowLEDs; // Show LEDs (Win32) bool ShowLEDs; // Show LEDs (Win32)
#ifdef __mac__
void ChangeDisks(void);
#endif
#ifdef WIN32
private:
static BOOL CALLBACK StandardDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
static BOOL CALLBACK WIN32DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
BOOL DialogProc(int page, HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
void SetupControls(int page);
void SetValues(int page);
void GetValues(int page);
void BrowseForDevice(int id);
static Prefs *edit_prefs;
static char *edit_prefs_name;
static HWND hDlg;
#endif
#ifdef HAVE_SDL
int DisplayOption;
uint32 MsPerFrame; uint32 MsPerFrame;
#endif
int JoystickAxes[MAX_JOYSTICK_AXES]; int JoystickAxes[MAX_JOYSTICK_AXES];
int JoystickHats[MAX_JOYSTICK_HATS]; int JoystickHats[MAX_JOYSTICK_HATS];
int JoystickButtons[MAX_JOYSTICK_BUTTONS]; int JoystickButtons[MAX_JOYSTICK_BUTTONS];

View File

@ -191,8 +191,8 @@ const char *options_menu_messages[14] = {
/*03*/ "^|ON|OFF", /*03*/ "^|ON|OFF",
/*04*/ "1541 Floppy Drive LED", /*04*/ "1541 Floppy Drive LED",
/*05*/ "^|ON|OFF", /*05*/ "^|ON|OFF",
/*06*/ "Display resolution", /*06*/ "Display",
/*07*/ "^|double-center|stretched", /*07*/ "^|window|fullscreen",
/*08*/ "Speed (approx. %)", /*08*/ "Speed (approx. %)",
/*09*/ "^|95|100|110", /*09*/ "^|95|100|110",
/*10*/ "Reset the C=64", /*10*/ "Reset the C=64",
@ -241,11 +241,14 @@ const char **options_menu_help[14] = {
}, },
NULL, NULL,
(const char*[]){ (const char*[]){
"Select display resolution", "Select display settings.",
"mapping. Double-center", "Fullscreen attemts to run",
"removes some pixels on the", "in fullscreen mode, while.",
"borders, stretched fills", "windowed uses a window.",
"the display but is slower.", "Activated on next restart.",
" ",
"On the Wii, fullscreen is",
"always used",
NULL, NULL,
}, },
NULL, NULL,

View File

@ -59,7 +59,7 @@ public:
Gui::gui->np->JoystickSwap = !this->p_submenus[0].sel; Gui::gui->np->JoystickSwap = !this->p_submenus[0].sel;
Gui::gui->np->Emul1541Proc = !this->p_submenus[1].sel; Gui::gui->np->Emul1541Proc = !this->p_submenus[1].sel;
Gui::gui->np->ShowLEDs = !this->p_submenus[2].sel; Gui::gui->np->ShowLEDs = !this->p_submenus[2].sel;
Gui::gui->np->DisplayOption = this->p_submenus[3].sel; Gui::gui->np->DisplayType = this->p_submenus[3].sel == 0 ? DISPTYPE_WINDOW : DISPTYPE_SCREEN;
switch (this->p_submenus[4].sel) switch (this->p_submenus[4].sel)
{ {
@ -81,7 +81,7 @@ public:
submenu_defs[0] = Gui::gui->np->JoystickSwap == true ? 0 : 1; submenu_defs[0] = Gui::gui->np->JoystickSwap == true ? 0 : 1;
submenu_defs[1] = !Gui::gui->np->Emul1541Proc; submenu_defs[1] = !Gui::gui->np->Emul1541Proc;
submenu_defs[2] = !Gui::gui->np->ShowLEDs; submenu_defs[2] = !Gui::gui->np->ShowLEDs;
submenu_defs[3] = Gui::gui->np->DisplayOption; submenu_defs[3] = Gui::gui->np->DisplayType == DISPTYPE_SCREEN;
switch (Gui::gui->np->MsPerFrame) switch (Gui::gui->np->MsPerFrame)
{ {

View File

@ -77,11 +77,15 @@ public:
if (this->loadSnapshot) if (this->loadSnapshot)
{ {
int display_type = ThePrefs.DisplayType;
TheC64->LoadSnapshot(new_path); TheC64->LoadSnapshot(new_path);
this->updateGameInfo(fileName); this->updateGameInfo(fileName);
Gui::gui->updateGameInfo(Gui::gui->sgv->gameInfo->gi); Gui::gui->updateGameInfo(Gui::gui->sgv->gameInfo->gi);
ThePrefs.Load(prefs_path); ThePrefs.Load(prefs_path);
/* Don't change display type */
ThePrefs.DisplayType = display_type;
} else } else
unlink(new_path); unlink(new_path);
free(prefs_path); free(prefs_path);

View File

@ -120,8 +120,6 @@ extern "C" int main(int argc, char **argv)
return 1; return 1;
} }
if (!init_graphics())
return 1;
fflush(stdout); fflush(stdout);
Frodo *the_app = new Frodo(); Frodo *the_app = new Frodo();
@ -246,6 +244,8 @@ void Frodo::ReadyToRun(void)
if (network_server_connect) if (network_server_connect)
strncpy(ThePrefs.NetworkServer, network_server_connect, strncpy(ThePrefs.NetworkServer, network_server_connect,
sizeof(ThePrefs.NetworkServer)); sizeof(ThePrefs.NetworkServer));
panic_if (!init_graphics(),
"Can't initialize graphics!\n");
// Create and start C64 // Create and start C64
TheC64 = new C64; TheC64 = new C64;