Skip to content

Commit

Permalink
More dynamic handling and macOS fixes
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <falktx@falktx.com>
  • Loading branch information
falkTX committed Mar 17, 2024
1 parent fbfbe99 commit 345a3ef
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/PawPaw
Submodule PawPaw updated 1 files
+1 −1 bootstrap-mod.sh
12 changes: 9 additions & 3 deletions src/plugin/DesktopPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,15 @@ class DesktopPlugin : public Plugin,
return;
}

portBaseNum = availablePortNum;

bufferSizeChanged(getBufferSize());

if (shm.data == nullptr && ! shm.init(availablePortNum))
{
parameters[kParameterBasePortNumber] = portBaseNum = -kErrorShmSetupFailed;
return;
}

portBaseNum = availablePortNum;
}

~DesktopPlugin()
Expand Down Expand Up @@ -351,7 +357,7 @@ class DesktopPlugin : public Plugin,
{
firstTimeActivating = false;

if (run())
if (portBaseNum > 0 && run())
startRunner(500);
}
else
Expand Down
3 changes: 1 addition & 2 deletions src/plugin/SharedMemory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ class SharedMemory
CloseHandle(shm);
#else
std::snprintf(shmName, 31, "/mod-desktop-shm-%d", portBaseNum);
const int fd = shm_open(shmName, O_RDWR, 0);
const int fd = shm_open(shmName, O_RDONLY, 0);

if (fd < 0)
return true;

close(fd);
shm_unlink(shmName);
#endif

return false;
Expand Down
1 change: 1 addition & 0 deletions src/plugin/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ static const wchar_t* getAppDirW()
const char* getAppDir()
{
#ifdef DISTRHO_OS_MAC
// return "/Users/falktx/Source/MOD/mod-app/build/mod-desktop.app/Contents/MacOS";
return "/Applications/MOD Desktop.app/Contents/MacOS";
#else
static char appDir[PATH_MAX] = {};
Expand Down

0 comments on commit 345a3ef

Please sign in to comment.