Skip to content
This repository has been archived by the owner on Jun 26, 2019. It is now read-only.

Commit

Permalink
fixed data dir detection on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
oy committed Dec 3, 2018
1 parent a25f7e5 commit 6febd33
Show file tree
Hide file tree
Showing 5 changed files with 395 additions and 3 deletions.
1 change: 1 addition & 0 deletions bam.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ function GenerateMacOSXSettings(settings, conf, arch, compiler)
settings.link.frameworks:Add("AGL")
-- FIXME: the SDL config is applied in BuildClient too but is needed here before so the launcher will compile
config.sdl:Apply(settings)
settings.link.extrafiles:Merge(Compile(settings, "src/osxlaunch/client.m"))
BuildClient(settings)

-- Content
Expand Down
7 changes: 6 additions & 1 deletion src/engine/client/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2443,9 +2443,14 @@ void CClient::HandleTeeworldsConnectLink(const char *pConLink)
Prediction Latency
Upstream latency
*/

#if defined(CONF_PLATFORM_MACOSX)
extern "C" int SDL_main(int argc, char **argv_) // ignore_convention
{
const char **argv = const_cast<const char **>(argv_);
#else
int main(int argc, const char **argv) // ignore_convention
{
#endif
#if defined(CONF_FAMILY_WINDOWS)
#ifdef CONF_RELEASE
bool HideConsole = true;
Expand Down
3 changes: 1 addition & 2 deletions src/engine/shared/storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ class CStorage : public IStorage
"/usr/local/share/games/teeworlds/data",
"/usr/pkg/share/teeworlds/data",
"/usr/pkg/share/games/teeworlds/data",
"/opt/teeworlds/data",
"/Volumes/Teeworlds/Teeworlds.app/Contents/Resources/data"
"/opt/teeworlds/data"
};
const int DirsCount = sizeof(aDirs) / sizeof(aDirs[0]);

Expand Down
14 changes: 14 additions & 0 deletions src/osxlaunch/client.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef OSXLAUNCH_CLIENT_H
#define OSXLAUNCH_CLIENT_H
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <[email protected]>
Non-NIB-Code & other changes: Max Horn <[email protected]>

Feel free to customize this file to suit your needs
*/

#import <Cocoa/Cocoa.h>

@interface SDLMain : NSObject<NSApplicationDelegate>
@end
#endif
Loading

0 comments on commit 6febd33

Please sign in to comment.