Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on Mac OS X Compatibility #473

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 2.8)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-inconsistent-missing-override")
project(emulationstation-all)

#-------------------------------------------------------------------------------
Expand Down
13 changes: 12 additions & 1 deletion es-app/src/SystemData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,24 @@ void SystemData::populateFolder(FileData* folder)
//fyi, folders *can* also match the extension and be added as games - this is mostly just to support higan
//see issue #75: https://github.com/Aloshi/EmulationStation/issues/75

//We'll ignore any filenames starting with a period.
//
//Generally a good idea on unix-ish systems, but especially important on OS X when files are stored
//on a filesystem (e.g. network share) which does not have native support for HFS+ metadata.
//
//In that situation, OS X puts ._SomeFile clutter all over the place.

std::string prefix = ".";

isGame = false;
if(std::find(mSearchExtensions.begin(), mSearchExtensions.end(), extension) != mSearchExtensions.end())
if(std::find(mSearchExtensions.begin(), mSearchExtensions.end(), extension) != mSearchExtensions.end() &&
filePath.filename().string().compare(0, prefix.length(), prefix) != 0)
{
FileData* newGame = new FileData(GAME, filePath.generic_string(), this);
folder->addChild(newGame);
isGame = true;
}


//add directories that also do not match an extension as folders
if(!isGame && fs::is_directory(filePath))
Expand Down
10 changes: 5 additions & 5 deletions es-app/src/VolumeControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ std::weak_ptr<VolumeControl> VolumeControl::sInstance;
VolumeControl::VolumeControl()
: originalVolume(0), internalVolume(0)
#if defined (__APPLE__)
#error TODO: Not implemented for MacOS yet!!!

#elif defined(__linux__)
, mixerIndex(0), mixerHandle(nullptr), mixerElem(nullptr), mixerSelemId(nullptr)
#elif defined(WIN32) || defined(_WIN32)
Expand Down Expand Up @@ -68,7 +68,7 @@ void VolumeControl::init()
{
//initialize audio mixer interface
#if defined (__APPLE__)
#error TODO: Not implemented for MacOS yet!!!
#elif defined(__linux__)
//try to open mixer device
if (mixerHandle == nullptr)
Expand Down Expand Up @@ -212,7 +212,7 @@ void VolumeControl::deinit()
{
//deinitialize audio mixer interface
#if defined (__APPLE__)
#error TODO: Not implemented for MacOS yet!!!
#elif defined(__linux__)
if (mixerHandle != nullptr) {
snd_mixer_detach(mixerHandle, mixerCard);
Expand All @@ -239,7 +239,7 @@ int VolumeControl::getVolume() const
int volume = 0;

#if defined (__APPLE__)
#error TODO: Not implemented for MacOS yet!!!
return 0;
#elif defined(__linux__)
if (mixerElem != nullptr)
{
Expand Down Expand Up @@ -333,7 +333,7 @@ void VolumeControl::setVolume(int volume)
//store values in internal variables
internalVolume = volume;
#if defined (__APPLE__)
#error TODO: Not implemented for MacOS yet!!!
return;
#elif defined(__linux__)
if (mixerElem != nullptr)
{
Expand Down
4 changes: 2 additions & 2 deletions es-app/src/VolumeControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <stdint.h>

#if defined (__APPLE__)
#error TODO: Not implemented for MacOS yet!!!

#elif defined(__linux__)
#include <unistd.h>
#include <fcntl.h>
Expand All @@ -22,7 +22,7 @@ Singleton pattern. Call getInstance() to get an object.
class VolumeControl
{
#if defined (__APPLE__)
#error TODO: Not implemented for MacOS yet!!!

#elif defined(__linux__)
static const char * mixerName;
static const char * mixerCard;
Expand Down
4 changes: 3 additions & 1 deletion es-app/src/components/TextListComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ class TextListComponent : public IList<TextListData, T>
using IList<TextListData, T>::getTransform;
using IList<TextListData, T>::mSize;
using IList<TextListData, T>::mCursor;
#ifndef __APPLE__
using IList<TextListData, T>::Entry;

#endif

public:
using IList<TextListData, T>::size;
using IList<TextListData, T>::isScrolling;
Expand Down
4 changes: 2 additions & 2 deletions es-core/src/AudioManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <SDL.h>
#include "Log.h"

std::vector<std::shared_ptr<Sound>> AudioManager::sSoundVector;
std::vector<std::shared_ptr<Sound> > AudioManager::sSoundVector;
SDL_AudioSpec AudioManager::sAudioFormat;
std::shared_ptr<AudioManager> AudioManager::sInstance;

Expand All @@ -16,7 +16,7 @@ void AudioManager::mixAudio(void *unused, Uint8 *stream, int len)
SDL_memset(stream, 0, len);

//iterate through all our samples
std::vector<std::shared_ptr<Sound>>::const_iterator soundIt = sSoundVector.cbegin();
std::vector<std::shared_ptr<Sound> >::const_iterator soundIt = sSoundVector.cbegin();
while (soundIt != sSoundVector.cend())
{
std::shared_ptr<Sound> sound = *soundIt;
Expand Down
2 changes: 1 addition & 1 deletion es-core/src/AudioManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class AudioManager
{
static SDL_AudioSpec sAudioFormat;
static std::vector<std::shared_ptr<Sound>> sSoundVector;
static std::vector<std::shared_ptr<Sound> > sSoundVector;
static std::shared_ptr<AudioManager> sInstance;

static void mixAudio(void *unused, Uint8 *stream, int len);
Expand Down
15 changes: 14 additions & 1 deletion es-core/src/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,18 @@
Window::Window() : mNormalizeNextUpdate(false), mFrameTimeElapsed(0), mFrameCountElapsed(0), mAverageDeltaTime(10),
mAllowSleep(true), mSleeping(false), mTimeSinceLastInput(0)
{

mHelp = new HelpComponent(this);
mBackgroundOverlay = new ImageComponent(this);
mBackgroundOverlay->setImage(":/scroll_gradient.png");


#ifndef __APPLE__
// This ends up calling some OpenGL methods before SDL has been asked to create a context
// On Mac OS X at least, this causes a EXC_BAD_ACCESS (segfault)
mBackgroundOverlay->setImage(":/scroll_gradient.png");
#endif


}

Window::~Window()
Expand Down Expand Up @@ -59,6 +68,9 @@ GuiComponent* Window::peekGui()

bool Window::init(unsigned int width, unsigned int height)
{



if(!Renderer::init(width, height))
{
LOG(LogError) << "Renderer failed to initialize!";
Expand All @@ -69,6 +81,7 @@ bool Window::init(unsigned int width, unsigned int height)

ResourceManager::getInstance()->reloadAll();


//keep a reference to the default fonts, so they don't keep getting destroyed/recreated
if(mDefaultFonts.empty())
{
Expand Down
6 changes: 4 additions & 2 deletions es-core/src/components/ImageGridComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ class ImageGridComponent : public IList<ImageGridData, T>
using IList<ImageGridData, T>::getTransform;
using IList<ImageGridData, T>::mSize;
using IList<ImageGridData, T>::mCursor;
using IList<ImageGridData, T>::Entry;
using IList<ImageGridData, T>::mWindow;
#ifndef __APPLE__
using IList<ImageGridData, T>::Entry;
#endif
using IList<ImageGridData, T>::mWindow;

public:
using IList<ImageGridData, T>::size;
Expand Down