mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-23 00:34:22 +00:00
LaunchAPPL: improve detection for classic/carbon
This commit is contained in:
parent
da6426b207
commit
c6f6cddb68
@ -9,9 +9,7 @@ if(APPLE)
|
||||
LIST(APPEND LAUNCHMETHODS
|
||||
Classic.h Classic.cc
|
||||
)
|
||||
find_program(LAUNCHCFMAPP LaunchCFMApp)
|
||||
if(LAUNCHCFMAPP)
|
||||
add_definitions(-DHAS_LAUNCHCFMAPP)
|
||||
LIST(APPEND LAUNCHMETHODS
|
||||
Carbon.h Carbon.cc)
|
||||
endif()
|
||||
|
@ -1,6 +1,9 @@
|
||||
#include "Carbon.h"
|
||||
#include "Launcher.h"
|
||||
|
||||
const std::string launchCFM =
|
||||
"/System/Library/Frameworks/Carbon.framework/Versions/A/Support/LaunchCFMApp";
|
||||
|
||||
namespace po = boost::program_options;
|
||||
|
||||
class CarbonLauncher : public Launcher
|
||||
@ -26,7 +29,15 @@ CarbonLauncher::~CarbonLauncher()
|
||||
|
||||
bool CarbonLauncher::Go(int timeout)
|
||||
{
|
||||
return ChildProcess("LaunchCarbon", { appPath.string() }, timeout) == 0;
|
||||
return ChildProcess(launchCFM, { appPath.string() }, timeout) == 0;
|
||||
}
|
||||
|
||||
bool Carbon::CheckPlatform()
|
||||
{
|
||||
/* If LaunchCFMApp doesn't exist, we're likely on a Mac OS X version
|
||||
where it doesn't exist anymore (10.7 Lion or later),
|
||||
or on an entirely different platform. */
|
||||
return CheckExecutable(launchCFM);
|
||||
}
|
||||
|
||||
std::unique_ptr<Launcher> Carbon::MakeLauncher(variables_map &options)
|
||||
|
@ -8,6 +8,7 @@ class Carbon : public LaunchMethod
|
||||
public:
|
||||
virtual std::string GetName() { return "carbon"; }
|
||||
|
||||
virtual bool CheckPlatform();
|
||||
virtual std::unique_ptr<Launcher> MakeLauncher(variables_map& options);
|
||||
};
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
#if defined(__APPLE__) && defined(__powerpc)
|
||||
#define ResType MacResType
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#undef ResType
|
||||
|
||||
#if TARGET_CPU_PPC
|
||||
#include "Classic.h"
|
||||
#include "Launcher.h"
|
||||
|
||||
#define ResType MacResType
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
namespace po = boost::program_options;
|
||||
|
||||
@ -63,6 +65,16 @@ bool ClassicLauncher::Go(int timeout)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Classic::CheckPlatform()
|
||||
{
|
||||
long sysver = 0;
|
||||
Gestalt(gestaltSystemVersion, &sysver);
|
||||
if(sysver >= 0x1050)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
std::unique_ptr<Launcher> Classic::MakeLauncher(variables_map &options)
|
||||
{
|
||||
return std::unique_ptr<Launcher>(new ClassicLauncher(options));
|
||||
|
@ -8,6 +8,7 @@ class Classic : public LaunchMethod
|
||||
public:
|
||||
virtual std::string GetName() { return "classic"; }
|
||||
|
||||
virtual bool CheckPlatform();
|
||||
virtual std::unique_ptr<Launcher> MakeLauncher(variables_map& options);
|
||||
};
|
||||
|
||||
|
@ -8,10 +8,13 @@
|
||||
#include "LaunchMethod.h"
|
||||
#include "Launcher.h"
|
||||
|
||||
#if defined(__APPLE__) && defined(__powerpc)
|
||||
#if defined(__APPLE__)
|
||||
# define ResType MacResType
|
||||
# include <ApplicationServices/ApplicationServices.h>
|
||||
# undef ResType
|
||||
# if TARGET_CPU_PPC
|
||||
# include "Classic.h"
|
||||
#endif
|
||||
#ifdef HAS_LAUNCHCFMAPP
|
||||
# endif
|
||||
# include "Carbon.h"
|
||||
#endif
|
||||
#include "Executor.h"
|
||||
@ -30,16 +33,22 @@ static vector<LaunchMethod*> launchMethods;
|
||||
|
||||
static void RegisterLaunchMethods()
|
||||
{
|
||||
launchMethods = {
|
||||
#if defined(__APPLE__) && defined(__powerpc)
|
||||
vector<LaunchMethod*> methods = {
|
||||
#if defined(__APPLE__)
|
||||
# if TARGET_CPU_PPC
|
||||
new Classic(),
|
||||
#endif
|
||||
#ifdef HAS_LAUNCHCFMAPP
|
||||
# endif
|
||||
new Carbon(),
|
||||
#endif
|
||||
new Executor(), new MiniVMac()
|
||||
// #### Add new `LaunchMethod`s here.
|
||||
};
|
||||
|
||||
for(LaunchMethod *m : methods)
|
||||
{
|
||||
if(m->CheckPlatform())
|
||||
launchMethods.push_back(m);
|
||||
}
|
||||
}
|
||||
|
||||
static void usage()
|
||||
|
@ -18,6 +18,11 @@ void LaunchMethod::GetOptions(boost::program_options::options_description &desc)
|
||||
{
|
||||
}
|
||||
|
||||
bool LaunchMethod::CheckPlatform()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LaunchMethod::CheckOptions(boost::program_options::variables_map &options)
|
||||
{
|
||||
return true;
|
||||
|
@ -20,6 +20,8 @@ public:
|
||||
|
||||
virtual std::string GetName() = 0;
|
||||
virtual void GetOptions(options_description& desc);
|
||||
|
||||
virtual bool CheckPlatform();
|
||||
virtual bool CheckOptions(variables_map& options);
|
||||
|
||||
virtual std::unique_ptr<Launcher> MakeLauncher(variables_map& options) = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user