-
Notifications
You must be signed in to change notification settings - Fork 40
[WIP] MacOS 64 Build #108
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
[WIP] MacOS 64 Build #108
Changes from all commits
afb37a3
687a788
0e20881
7d47e91
332dc97
4d86da4
621b194
07f3636
7838d1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Created by https://www.toptal.com/developers/gitignore/api/xcode,macos | ||
| # Edit at https://www.toptal.com/developers/gitignore?templates=xcode,macos | ||
|
|
||
| ### macOS ### | ||
| # General | ||
| .DS_Store | ||
| .AppleDouble | ||
| .LSOverride | ||
|
|
||
| # Icon must end with two \r | ||
| Icon | ||
|
|
||
|
|
||
| # Thumbnails | ||
| ._* | ||
|
|
||
| # Files that might appear in the root of a volume | ||
| .DocumentRevisions-V100 | ||
| .fseventsd | ||
| .Spotlight-V100 | ||
| .TemporaryItems | ||
| .Trashes | ||
| .VolumeIcon.icns | ||
| .com.apple.timemachine.donotpresent | ||
|
|
||
| # Directories potentially created on remote AFP share | ||
| .AppleDB | ||
| .AppleDesktop | ||
| Network Trash Folder | ||
| Temporary Items | ||
| .apdisk | ||
|
|
||
| ### macOS Patch ### | ||
| # iCloud generated files | ||
| *.icloud | ||
|
|
||
| ### Xcode ### | ||
| ## User settings | ||
| xcuserdata/ | ||
|
|
||
| ## Xcode 8 and earlier | ||
| *.xcscmblueprint | ||
| *.xccheckout | ||
|
|
||
| ### Xcode Patch ### | ||
| *.xcodeproj/* | ||
| !*.xcodeproj/project.pbxproj | ||
| !*.xcodeproj/xcshareddata/ | ||
| !*.xcodeproj/project.xcworkspace/ | ||
| !*.xcworkspace/contents.xcworkspacedata | ||
| /*.gcno | ||
| **/xcshareddata/WorkspaceSettings.xcsettings | ||
|
|
||
| # End of https://www.toptal.com/developers/gitignore/api/xcode,macos | ||
|
|
Large diffs are not rendered by default.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| <plist version="1.0"> | ||
| <dict> | ||
| <key>IDEDidComputeMac32BitWarning</key> | ||
| <true/> | ||
| </dict> | ||
| </plist> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| <CONFIG> | ||
| <DUMPEVENT value="YES"/> | ||
| <SCREENMULT value="2"/> <!-- increase screen size --> | ||
|
|
||
| <KEY_A value="a"/> | ||
| <KEY_B value="s"/> | ||
| <KEY_LSHOULDER value="x" /> | ||
| <KEY_RSHOULDER value="left shift" /> | ||
|
|
||
| <KEY_UP value="up" /> | ||
| <KEY_DOWN value="down" /> | ||
| <KEY_LEFT value="left" /> | ||
| <KEY_RIGHT value="right" /> | ||
|
|
||
| <KEY_START value="space" /> | ||
|
|
||
| <!-- Default colors below --> | ||
| <BACKGROUND value = "1D0A1F"/> <!--Background color--> | ||
| <FOREGROUND value = "F5EBFF"/> <!--Text color--> | ||
| <HICOLOR1 value = "B750D1"/> <!--Highlight color 1--> | ||
| <HICOLOR2 value = "DB33DB"/> <!--Highlight color 2--> | ||
| <CURSORCOLOR value = "FF00DD"/> <!--Cursor color--> | ||
| <SONGVIEW_FE value = "A55B8F" /> <!--Alt chain color1--> | ||
| <SONGVIEW_00 value = "853B6F" /> <!--Alt chain color2--> | ||
| <ROWCOLOR1 value = "BA28F9"/> <!--Row count color 1 --> | ||
| <ROWCOLOR2 value = "FF00FF"/> <!--Row count color 2--> | ||
| <ALTROWNUMBER value = "4"/> <!--How many rows before alternating--> | ||
| <MAJORBEAT value = "BA28F9"/> <!--major beat color --> | ||
|
|
||
| </CONFIG> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| #include "Application/Application.h" | ||
| #include "Adapters/MacOS/MacOSSystem/MacOSSystem.h" | ||
| #include "Adapters/SDL2/GUI/SDLGUIWindowImp.h" | ||
|
|
||
| #include <string.h> | ||
|
|
||
| int main(int argc,char *argv[]) | ||
| { | ||
| MacOSSystem::Boot(argc,argv) ; | ||
|
|
||
| SDLCreateWindowParams params ; | ||
| params.title="littlegptracker" ; | ||
| params.cacheFonts_=false ; | ||
|
|
||
| Application::GetInstance()->Init(params) ; | ||
|
|
||
| int retval=MacOSSystem::MainLoop() ; | ||
|
|
||
| return retval ; | ||
| } |
|
djdiskmachine marked this conversation as resolved.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,218 @@ | ||
|
|
||
| #include "MacOSSystem.h" | ||
| #include "Adapters/RTMidi/RTMidiService.h" | ||
| #include "Adapters/RTAudio/RTAudioStub.h" | ||
| #ifndef _USE_NCURSES_ | ||
| #include "Adapters/SDL2/GUI/GUIFactory.h" | ||
| #include "Adapters/SDL2/GUI/SDLGUIWindowImp.h" | ||
| #else | ||
| #include "Adapters/Unix/GUI/GUIFactory.h" | ||
| #endif | ||
| #include "Adapters/Unix/FileSystem/UnixFileSystem.h" | ||
| #include "Adapters/Unix/Process/UnixProcess.h" | ||
| #include "Application/Model/Config.h" | ||
| #include "Adapters/SDL2/Timer/SDLTimer.h" | ||
| #include "System/Console/Trace.h" | ||
| #include "System/Console/Logger.h" | ||
| #include <time.h> | ||
| #include <sys/time.h> | ||
| #include <memory.h> | ||
| #include <CoreFoundation/CoreFoundation.h> | ||
|
|
||
| EventManager *MacOSSystem::eventManager_ = NULL ; | ||
|
|
||
| int MacOSSystem::MainLoop() | ||
| { | ||
| eventManager_->InstallMappings() ; | ||
| return eventManager_->MainLoop() ; | ||
| } | ||
|
|
||
| void MacOSSystem::Boot(int argc,char **argv) | ||
| { | ||
| // Install System | ||
| System::Install(new MacOSSystem()) ; | ||
|
|
||
| // Install GUI Factory | ||
| I_GUIWindowFactory::Install(new GUIFactory()) ; | ||
|
|
||
| // Install FileSystem | ||
| FileSystem::Install(new UnixFileSystem()) ; | ||
|
|
||
| installAliases(); | ||
|
|
||
| // Tracing | ||
|
|
||
| #ifdef _DEBUG | ||
| Trace::GetInstance()->SetLogger(*(new StdOutLogger())); | ||
| #else | ||
| Path logPath("bin:lgpt.log"); | ||
| FileLogger *fileLogger=new FileLogger(logPath); | ||
| if(fileLogger->Init().Succeeded()) | ||
| { | ||
| Trace::GetInstance()->SetLogger(*fileLogger); | ||
| } | ||
| #endif | ||
|
|
||
| Config::GetInstance()->ProcessArguments(argc,argv) ; | ||
|
|
||
| // Install Timers | ||
|
|
||
| TimerService::GetInstance()->Install(new SDLTimerService()) ; | ||
|
|
||
| // Install Sound | ||
|
|
||
| AudioSettings hints ; | ||
| hints.audioAPI_="" ; | ||
| hints.audioDevice_="" ; | ||
| hints.bufferSize_=64 ; | ||
| hints.preBufferCount_=0; | ||
|
|
||
| Audio::Install(new RTAudioStub(hints)) ; | ||
|
|
||
| // Install Midi | ||
| MidiService::Install(new RTMidiService()) ; | ||
|
|
||
| // Install Threads | ||
|
|
||
| SysProcessFactory::Install(new UnixProcessFactory()) ; | ||
|
|
||
| eventManager_=I_GUIWindowFactory::GetInstance()->GetEventManager() ; | ||
| eventManager_->Init() ; | ||
|
|
||
| eventManager_->MapAppButton("a",APP_BUTTON_A) ; | ||
| eventManager_->MapAppButton("s",APP_BUTTON_B) ; | ||
| eventManager_->MapAppButton("left",APP_BUTTON_LEFT) ; | ||
| eventManager_->MapAppButton("right",APP_BUTTON_RIGHT) ; | ||
| eventManager_->MapAppButton("up",APP_BUTTON_UP) ; | ||
| eventManager_->MapAppButton("down",APP_BUTTON_DOWN) ; | ||
| eventManager_->MapAppButton("x",APP_BUTTON_L) ; | ||
| eventManager_->MapAppButton("left shift",APP_BUTTON_R) ; | ||
| eventManager_->MapAppButton("space",APP_BUTTON_START) ; | ||
|
|
||
|
|
||
| } | ||
|
|
||
| void MacOSSystem::Shutdown() | ||
| { | ||
| } | ||
|
|
||
| void MacOSSystem::installAliases() | ||
| { | ||
| // aliases | ||
|
|
||
| char path[1024]; | ||
| CFBundleRef mainBundle = CFBundleGetMainBundle(); | ||
| NAssert( mainBundle ); | ||
|
|
||
| CFURLRef mainBundleURL = CFBundleCopyBundleURL( mainBundle); | ||
| NAssert( mainBundleURL); | ||
|
|
||
| CFStringRef cfStringRef = CFURLCopyFileSystemPath( mainBundleURL, kCFURLPOSIXPathStyle); | ||
| NAssert( cfStringRef); | ||
|
|
||
| CFStringGetCString( cfStringRef, path, 1024, kCFStringEncodingASCII); | ||
|
|
||
| CFRelease( mainBundleURL); | ||
| CFRelease( cfStringRef ); | ||
|
|
||
| std::string asciiPath = path; | ||
|
|
||
| // get the package directory: | ||
| std::string::size_type pos = asciiPath.find_last_of('/'); | ||
| std::string directoryPath (asciiPath, 0, pos); | ||
|
|
||
| // set the bin path alias: | ||
| std::string binPath = directoryPath; | ||
|
|
||
| Path::SetAlias("bin",binPath.c_str()) ; | ||
| Path::SetAlias("root",binPath.c_str()) ; | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------ | ||
|
|
||
|
|
||
| static long secbase=0; | ||
|
|
||
| unsigned long MacOSSystem::GetClock() { | ||
|
|
||
| struct timeval tp; | ||
|
|
||
| gettimeofday(&tp, NULL); | ||
| if (!secbase) | ||
| { | ||
| secbase = tp.tv_sec; | ||
| return long(tp.tv_usec/1000.0); | ||
| } | ||
| return long((tp.tv_sec - secbase)*1000 + tp.tv_usec/1000.0); | ||
| } | ||
|
|
||
|
|
||
| //------------------------------------------------------------------------------ | ||
|
|
||
|
|
||
| void MacOSSystem::Sleep(int millisec) | ||
| { | ||
| /* if (millisec>0) | ||
| ::Sleep(millisec) ; | ||
| */} | ||
|
|
||
|
|
||
| //------------------------------------------------------------------------------ | ||
|
|
||
| void *MacOSSystem::Malloc(unsigned size) | ||
| { | ||
| return malloc(size) ; | ||
| } | ||
|
|
||
|
|
||
| //------------------------------------------------------------------------------ | ||
|
|
||
| void MacOSSystem::Free(void *ptr) { | ||
| free(ptr) ; | ||
| } | ||
|
|
||
|
|
||
| //------------------------------------------------------------------------------ | ||
|
|
||
| void MacOSSystem::Memset(void *addr,char val,int size) { | ||
|
|
||
| unsigned long ad=(unsigned long)addr ; | ||
| if (((ad&0x3)==0)&&((size&0x3)==0)) { // Are we 4-byte aligned ? | ||
| unsigned int intVal=0 ; | ||
| for (int i=0;i<4;i++) { | ||
| intVal=(intVal<<8)+val ; | ||
| } | ||
| unsigned int *dst=(unsigned int *)addr ; | ||
| size_t intSize=size>>2 ; | ||
|
|
||
| for (unsigned int i=0;i<intSize;i++) { | ||
| *dst++=intVal ; | ||
| } | ||
| } else { | ||
| memset(addr,val,size) ; | ||
| } | ||
| } | ||
|
|
||
|
|
||
| //------------------------------------------------------------------------------ | ||
|
|
||
| void *MacOSSystem::Memcpy(void *s1, const void *s2, int n) | ||
| { | ||
| return memcpy(s1,s2,n) ; | ||
| } | ||
|
|
||
| //------------------------------------------------------------------------------ | ||
|
|
||
|
|
||
| void MacOSSystem::PostQuitMessage() | ||
| { | ||
| eventManager_->PostQuitMessage() ; | ||
| } | ||
|
|
||
|
|
||
| //------------------------------------------------------------------------------ | ||
|
|
||
| int unsigned MacOSSystem::GetMemoryUsage() | ||
| { | ||
| return 0 ; | ||
| } |
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since OSX is now deprecated, how about we move the references to this new path for these Main / System files? |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| #ifndef _MACOS_SYSTEM_H_ | ||
| #define _MACOS_SYSTEM_H_ | ||
|
|
||
| #include "System/System/System.h" | ||
| #include "UIFramework/SimpleBaseClasses/EventManager.h" | ||
|
|
||
| // TODO: Check how I can have a single place for all SDL based code | ||
| // So I don't have to check all of the System::MainLoop() | ||
|
|
||
| class MacOSSystem: public System { | ||
| public: | ||
| static void Boot(int argc,char **argv) ; | ||
| static void Shutdown() ; | ||
| static int MainLoop() ; | ||
|
|
||
| public: // System implementation | ||
| virtual unsigned long GetClock() ; | ||
| virtual void Sleep(int millisec); | ||
| virtual void *Malloc(unsigned size) ; | ||
| virtual void Free(void *) ; | ||
| virtual void Memset(void *addr,char val,int size) ; | ||
| virtual void *Memcpy(void *s1, const void *s2, int n) ; | ||
| virtual int GetBatteryLevel() { return -1 ; } ; | ||
| virtual void PostQuitMessage() ; | ||
| virtual unsigned int GetMemoryUsage() ; | ||
| static bool finished_ ; | ||
| protected: | ||
| static void installAliases(); | ||
| private: | ||
| static EventManager *eventManager_; | ||
| } ; | ||
| #endif |
Uh oh!
There was an error while loading. Please reload this page.