Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
cannonball
Commits
0c92abed
Commit
0c92abed
authored
Jul 08, 2013
by
reassembler
Browse files
Fixes for Mac OSX
parent
4c4cde9a
Changes
3
Hide whitespace changes
Inline
Side-by-side
cmake/macosx.cmake
0 → 100644
View file @
0c92abed
# Default CMake Setup. Used for Mac OS x builds
# For INTeL 32bit Mac OS X 10.5+
set
(
CMAKE_CXX_FLAGS
" -O2 -force_cpusubtype_ALL -mmacosx-version-min=10.5 -arch i386 -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -I/Developer/SDKs/MacOSX10.5.sdk/usr/X11R6/include/ "
)
# # For PowerPC 32bit Mac OS X 10.5+
# set(CMAKE_CXX_FLAGS " -O2 -faltivec -force_cpusubtype_ALL -mmacosx-version-min=10.5 -arch ppc -m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 -I/Developer/SDKs/MacOSX10.5.sdk/usr/X11R6/include/ ")
# Use OpenGL for rendering
set
(
OPENGL 1
)
# This is for MacPorts
set
(
lib_base /opt/local
)
set
(
sdl_root
${
lib_base
}
)
include_directories
(
"
${
sdl_root
}
/include/SDL/"
"
${
lib_base
}
/include/"
"/System/Library/Frameworks/"
)
find_library
(
COCOA_LIBRARY Cocoa
)
find_library
(
GLUT_LIBRARY GLUT
)
find_library
(
OpenGL_LIBRARY OpenGL
)
link_libraries
(
cannonball
SDL
SDLmain
${
COCOA_LIBRARY
}
${
GLUT_LIBRARY
}
${
OpenGL_LIBRARY
}
)
# Linking
link_directories
(
"
${
sdl_root
}
/lib"
)
# Location for Cannonball to create save files
# Used to auto-generate setup.hpp with various file paths
set
(
xml_directory ./
)
set
(
sdl_flags
"SDL_DOUBLEBUF | SDL_SWSURFACE"
)
src/main/romloader.cpp
View file @
0c92abed
...
...
@@ -16,6 +16,10 @@
#include "stdint.hpp"
#include "romloader.hpp"
#ifdef __APPLE__
#include "CoreFoundation/CoreFoundation.h"
#endif
RomLoader
::
RomLoader
()
{
...
...
@@ -38,6 +42,21 @@ void RomLoader::unload(void)
int
RomLoader
::
load
(
const
char
*
filename
,
const
int
offset
,
const
int
length
,
const
int
expected_crc
,
const
uint8_t
interleave
)
{
#ifdef __APPLE__
CFBundleRef
mainBundle
=
CFBundleGetMainBundle
();
CFURLRef
resourcesURL
=
CFBundleCopyResourcesDirectoryURL
(
mainBundle
);
char
bundlepath
[
PATH_MAX
];
if
(
!
CFURLGetFileSystemRepresentation
(
resourcesURL
,
TRUE
,
(
UInt8
*
)
bundlepath
,
PATH_MAX
))
{
// error!
}
CFRelease
(
resourcesURL
);
chdir
(
bundlepath
);
#endif
std
::
string
path
=
"roms/"
;
path
+=
std
::
string
(
filename
);
...
...
src/main/sdl/rendergl.cpp
View file @
0c92abed
...
...
@@ -108,9 +108,26 @@ bool RenderGL::init(int src_width, int src_height,
Rshift
=
surface
->
format
->
Rshift
;
Gshift
=
surface
->
format
->
Gshift
;
Bshift
=
surface
->
format
->
Bshift
;
Rmask
=
surface
->
format
->
Rmask
;
Gmask
=
surface
->
format
->
Gmask
;
Bmask
=
surface
->
format
->
Bmask
;
// This hack is necessary to fix an Apple OpenGL with SDL issue
#ifdef __APPLE__
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
Rmask
=
0x000000FF
;
Gmask
=
0x0000FF00
;
Bmask
=
0x00FF0000
;
Rshift
+=
8
;
Gshift
-=
8
;
Bshift
+=
8
;
#else
Rmask
=
0xFF000000
;
Gmask
=
0x00FF0000
;
Bmask
=
0x0000FF00
;
#endif
#else
Rmask
=
surface
->
format
->
Rmask
;
Gmask
=
surface
->
format
->
Gmask
;
Bmask
=
surface
->
format
->
Bmask
;
#endif
// --------------------------------------------------------------------------------------------
// Initalize Open GL
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment