Added ability to reset current game without reopening the same cartridge

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@360 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
markgrebe 2005-02-18 05:31:48 +00:00
parent 2909cf001d
commit 4bd87ac26c
6 changed files with 23 additions and 8 deletions

View File

@ -4,7 +4,7 @@
Mark Grebe <atarimac@cox.net>
*/
/* $Id: Menus.h,v 1.3 2004-08-02 04:08:10 markgrebe Exp $ */
/* $Id: Menus.h,v 1.4 2005-02-18 05:31:47 markgrebe Exp $ */
#import <Cocoa/Cocoa.h>
@ -36,6 +36,7 @@
- (IBAction)smallerScreen:(id)sender;
- (IBAction)fullScreen:(id)sender;
- (IBAction)openCart:(id)sender;
- (IBAction)restartGame:(id)sender;
- (IBAction)speedLimit:(id)sender;
- (IBAction)pauseGame:(id)sender;
- (IBAction)ntscPalMode:(id)sender;

View File

@ -4,7 +4,7 @@
Mark Grebe <atarimac@cox.net>
*/
/* $Id: Menus.m,v 1.3 2004-08-02 04:08:10 markgrebe Exp $ */
/* $Id: Menus.m,v 1.4 2005-02-18 05:31:47 markgrebe Exp $ */
#import <Cocoa/Cocoa.h>
#import "Menus.h"
@ -270,6 +270,11 @@ static Menus *sharedInstance = nil;
[self pushKeyEvent:SDLK_o:NO];
}
- (IBAction)restartGame:(id)sender
{
[self pushKeyEvent:SDLK_r:NO];
}
- (IBAction)speedLimit:(id)sender
{
[self pushKeyEvent:SDLK_l:NO];

View File

@ -22,6 +22,7 @@
pauseGame = id;
prefsMenu = id;
prefsOK = id;
restartGame = id;
rightJoyChange = id;
romdirSelect = id;
smallerScreen = id;

View File

@ -13,10 +13,10 @@
<string>349.0</string>
<key>IBOpenObjects</key>
<array>
<integer>578</integer>
<integer>29</integer>
<integer>578</integer>
</array>
<key>IBSystem Version</key>
<string>7H63</string>
<string>7U16</string>
</dict>
</plist>

Binary file not shown.

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: mainSDL.cxx,v 1.7 2005-02-18 01:05:23 markgrebe Exp $
// $Id: mainSDL.cxx,v 1.8 2005-02-18 05:31:47 markgrebe Exp $
//============================================================================
#include <fstream>
@ -157,7 +157,6 @@ static char *gameFile;
static bool fileToLoad = false;
struct Switches
{
SDLKey scanCode;
@ -549,6 +548,12 @@ void handleEvents()
theConsole->eventHandler().sendEvent(Event::Quit, 1);
}
}
else if(key == SDLK_r) // Command-r restarts the game
{
newGame = true;
fileToLoad = true;
theConsole->eventHandler().sendEvent(Event::Quit, 1);
}
else if(key == SDLK_g)
{
// don't change grabmouse in fullscreen mode
@ -1082,7 +1087,7 @@ int stellaMain(int argc, char* argv[])
while(1) {
// Get a pointer to the file which contains the cartridge ROM
char* file;
char* file = NULL;
if (fileToLoad)
{
@ -1092,6 +1097,8 @@ while(1) {
{
do
{
if (file != NULL)
free(file);
file = browseFile();
if (file == NULL)
{
@ -1101,6 +1108,7 @@ while(1) {
} while (file == NULL);
}
fileToLoad = false;
gameFile = file;
// Open the cartridge image and read it in
ifstream in(file, ios_base::binary);
@ -1134,7 +1142,7 @@ while(1) {
// Free the image since we don't need it any longer
delete[] image;
free(file);
// free(file);
// Setup the SDL joysticks
// This must be done after the console is created