From b1bfc2bcb92f0a3fd0ba2f5249be17d9623f24a4 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 5 Jan 2010 01:11:25 +0000 Subject: [PATCH] run p3dembed successfully on osx --- direct/src/plugin_standalone/Sources.pp | 3 ++- direct/src/plugin_standalone/p3dEmbed.cxx | 24 +++++++++++------------ 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/direct/src/plugin_standalone/Sources.pp b/direct/src/plugin_standalone/Sources.pp index 80a9155f48..de07ee73fd 100644 --- a/direct/src/plugin_standalone/Sources.pp +++ b/direct/src/plugin_standalone/Sources.pp @@ -96,7 +96,8 @@ prc:c dtoolutil:c dtoolbase:c dtool:m \ interrogatedb:c dconfig:c dtoolconfig:m \ pandabase:c downloader:c express:c pandaexpress:m \ - pystub + pystub \ + $[if $[OSX_PLATFORM],subprocbuffer] #define OSX_SYS_FRAMEWORKS Foundation AppKit Carbon diff --git a/direct/src/plugin_standalone/p3dEmbed.cxx b/direct/src/plugin_standalone/p3dEmbed.cxx index 3552487252..9e69830003 100644 --- a/direct/src/plugin_standalone/p3dEmbed.cxx +++ b/direct/src/plugin_standalone/p3dEmbed.cxx @@ -18,10 +18,10 @@ #include "load_plugin.h" #ifdef _WIN32 -unsigned long p3d_offset = 0xFF3D3D00; +volatile unsigned long p3d_offset = 0xFF3D3D00; #else #include -uint32_t p3d_offset = 0xFF3D3D00; +volatile uint32_t p3d_offset = 0xFF3D3D00; #endif //////////////////////////////////////////////////////////////////// @@ -41,6 +41,16 @@ P3DEmbed(bool console_environment) : Panda3DBase(console_environment) { //////////////////////////////////////////////////////////////////// int P3DEmbed:: run_embedded(streampos read_offset, int argc, char *argv[]) { + // Check to see if we've actually got an application embedded. If + // we do, read_offset will have been modified to contain a different + // value than the one we compiled in, above. We test against + // read_offset + 1, because any appearances of this exact number + // within the binary will be replaced (including this one). + if (read_offset + (streampos)1 == (streampos)0xFF3D3D01) { + cerr << "This program is not intended to be run directly.\nIt is used by pdeploy to construct an embedded Panda3D application.\n"; + return 1; + } + // Make sure the splash window will be put in the center of the screen _win_x = -2; _win_y = -2; @@ -155,16 +165,6 @@ run_embedded(streampos read_offset, int argc, char *argv[]) { int main(int argc, char *argv[]) { - // Check to see if we've actually got an application embedded. If - // we do, p3d_offset will have been modified to contain a different - // value than the one we compiled in, above. We test against - // p3d_offset + 1, because any appearances of this exact number - // within the binary will be replaced (including this one). - if (p3d_offset + 1 == 0xFF3D3D01) { - cerr << "This program is not intended to be run directly.\nIt is used by pdeploy to construct an embedded Panda3D application.\n"; - return 1; - } - P3DEmbed program(true); return program.run_embedded(p3d_offset, argc, argv); }