2005-05-28 01:28:36 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// SSSS tt lll lll
|
|
|
|
// SS SS tt ll ll
|
|
|
|
// SS tttttt eeee ll ll aaaa
|
|
|
|
// SSSS tt ee ee ll ll aa
|
|
|
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
|
|
|
// SS SS tt ee ll ll aa aa
|
|
|
|
// SSSS ttt eeeee llll llll aaaaa
|
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// Copyright (c) 1995-2010 by Bradford W. Mott and the Stella Team
|
2005-05-28 01:28:36 +00:00
|
|
|
//
|
2010-01-10 03:23:32 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
2005-05-28 01:28:36 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
2009-05-13 13:55:40 +00:00
|
|
|
// $Id$
|
2005-05-28 01:28:36 +00:00
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <sstream>
|
|
|
|
#include <fstream>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <sys/types.h>
|
2005-05-28 21:06:41 +00:00
|
|
|
#include <sys/param.h> /* for MAXPATHLEN */
|
2005-05-28 01:28:36 +00:00
|
|
|
|
|
|
|
#include "bspf.hxx"
|
|
|
|
#include "OSystem.hxx"
|
|
|
|
#include "OSystemMACOSX.hxx"
|
2006-04-05 02:18:58 +00:00
|
|
|
#include "MenusEvents.h"
|
2005-05-28 01:28:36 +00:00
|
|
|
|
|
|
|
extern "C" {
|
2006-01-08 02:28:04 +00:00
|
|
|
void macOpenConsole(char *romname);
|
2006-03-29 04:45:10 +00:00
|
|
|
void setEmulationMenus(void);
|
|
|
|
void setLauncherMenus(void);
|
|
|
|
void setOptionsMenus(void);
|
|
|
|
void setCommandMenus(void);
|
|
|
|
void setDebuggerMenus(void);
|
2006-04-05 02:18:58 +00:00
|
|
|
void macOSXSendMenuEvent(int event);
|
2005-05-28 01:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Pointer to the main parent osystem object or the null pointer
|
|
|
|
extern OSystem* theOSystem;
|
2005-05-28 21:06:41 +00:00
|
|
|
extern char parentdir[MAXPATHLEN];
|
2005-05-28 01:28:36 +00:00
|
|
|
|
|
|
|
// Allow the SDL main object to pass request to open cartridges from
|
|
|
|
// the OS into the application.
|
|
|
|
void macOpenConsole(char *romname)
|
|
|
|
{
|
2007-07-19 16:21:39 +00:00
|
|
|
theOSystem->deleteConsole();
|
|
|
|
theOSystem->createConsole(romname);
|
2005-05-28 01:28:36 +00:00
|
|
|
}
|
|
|
|
|
2006-04-05 02:18:58 +00:00
|
|
|
// Allow the Menus Objective-C object to pass event sends into the
|
|
|
|
// application.
|
|
|
|
void macOSXSendMenuEvent(int event)
|
|
|
|
{
|
2007-07-19 16:21:39 +00:00
|
|
|
switch(event)
|
|
|
|
{
|
|
|
|
case MENU_OPEN:
|
|
|
|
theOSystem->eventHandler().handleEvent(Event::LauncherMode, 1);
|
|
|
|
break;
|
|
|
|
case MENU_VOLUME_INCREASE:
|
|
|
|
theOSystem->eventHandler().handleEvent(Event::VolumeIncrease, 1);
|
|
|
|
break;
|
|
|
|
case MENU_VOLUME_DECREASE:
|
|
|
|
theOSystem->eventHandler().handleEvent(Event::VolumeDecrease, 1);
|
|
|
|
break;
|
|
|
|
}
|
2006-04-05 02:18:58 +00:00
|
|
|
}
|
|
|
|
|
2005-05-28 01:28:36 +00:00
|
|
|
/**
|
|
|
|
Each derived class is responsible for calling the following methods
|
|
|
|
in its constructor:
|
|
|
|
|
|
|
|
setBaseDir()
|
Removed all reference to 'user.pro', in favour of the previous (to v/2.0)
functionality. The new scheme is as follows:
- Per-user properties are stored in stella.pro, which is located in
system-specific directories (homedir for UNIX/POSIX systems, currentdir
for Win32 systems).
- Completely removed concept of a global properties file, since that
functionality is now included in Stella directly.
- Retained the ability to use an alternative properties file, in which
case the per-user one isn't used at all, and any entries in it override
the built-in defaults.
Removed all reference to 'system' vs. 'user' config files, for much the
same reasons as above. As above, config files are stored in
user-specific places depending on platform. There is no longer a
system-wide config file. This made sense when Stella didn't have built-in
defaults and relied on such a file, but that's no longer the case.
Sorry for any confusion this causes, but it was causing even more confusion
for users. And now we can distribute Stella has a single binary which
doesn't depend on any external files (but will still use them if they're
present).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1050 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2006-03-17 19:44:19 +00:00
|
|
|
setConfigFile()
|
2005-05-28 01:28:36 +00:00
|
|
|
|
|
|
|
See OSystem.hxx for a further explanation
|
|
|
|
*/
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2007-07-19 16:21:39 +00:00
|
|
|
OSystemMACOSX::OSystemMACOSX()
|
|
|
|
: OSystem()
|
2005-05-28 01:28:36 +00:00
|
|
|
{
|
2010-04-09 11:54:25 +00:00
|
|
|
setBaseDir("~/Library/Application Support/Stella");
|
2009-07-01 16:04:28 +00:00
|
|
|
|
|
|
|
// This will be overridden, as OSX uses plist files for settings
|
2010-04-09 11:54:25 +00:00
|
|
|
setConfigFile("~/Library/Application Support/Stella/stellarc");
|
2005-05-28 01:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
OSystemMACOSX::~OSystemMACOSX()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2006-03-27 16:00:37 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void OSystemMACOSX::stateChanged(EventHandler::State state)
|
|
|
|
{
|
|
|
|
switch(state)
|
|
|
|
{
|
|
|
|
case EventHandler::S_EMULATE:
|
2006-03-29 04:45:10 +00:00
|
|
|
setEmulationMenus();
|
2006-03-27 16:00:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EventHandler::S_LAUNCHER:
|
2006-03-29 04:45:10 +00:00
|
|
|
setLauncherMenus();
|
2006-03-27 16:00:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EventHandler::S_MENU:
|
2006-03-29 04:45:10 +00:00
|
|
|
setOptionsMenus();
|
2006-03-27 16:00:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EventHandler::S_CMDMENU:
|
2006-03-29 04:45:10 +00:00
|
|
|
setCommandMenus();
|
2006-03-27 16:00:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EventHandler::S_DEBUGGER:
|
2006-03-29 04:45:10 +00:00
|
|
|
setDebuggerMenus();
|
2006-03-27 16:00:37 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|