run p3dembed successfully on osx

This commit is contained in:
David Rose 2010-01-05 01:11:25 +00:00
parent c1bdd28ce6
commit b1bfc2bcb9
2 changed files with 14 additions and 13 deletions

View File

@ -96,7 +96,8 @@
prc:c dtoolutil:c dtoolbase:c dtool:m \ prc:c dtoolutil:c dtoolbase:c dtool:m \
interrogatedb:c dconfig:c dtoolconfig:m \ interrogatedb:c dconfig:c dtoolconfig:m \
pandabase:c downloader:c express:c pandaexpress:m \ pandabase:c downloader:c express:c pandaexpress:m \
pystub pystub \
$[if $[OSX_PLATFORM],subprocbuffer]
#define OSX_SYS_FRAMEWORKS Foundation AppKit Carbon #define OSX_SYS_FRAMEWORKS Foundation AppKit Carbon

View File

@ -18,10 +18,10 @@
#include "load_plugin.h" #include "load_plugin.h"
#ifdef _WIN32 #ifdef _WIN32
unsigned long p3d_offset = 0xFF3D3D00; volatile unsigned long p3d_offset = 0xFF3D3D00;
#else #else
#include <stdint.h> #include <stdint.h>
uint32_t p3d_offset = 0xFF3D3D00; volatile uint32_t p3d_offset = 0xFF3D3D00;
#endif #endif
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -41,6 +41,16 @@ P3DEmbed(bool console_environment) : Panda3DBase(console_environment) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
int P3DEmbed:: int P3DEmbed::
run_embedded(streampos read_offset, int argc, char *argv[]) { 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 // Make sure the splash window will be put in the center of the screen
_win_x = -2; _win_x = -2;
_win_y = -2; _win_y = -2;
@ -155,16 +165,6 @@ run_embedded(streampos read_offset, int argc, char *argv[]) {
int int
main(int argc, char *argv[]) { 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); P3DEmbed program(true);
return program.run_embedded(p3d_offset, argc, argv); return program.run_embedded(p3d_offset, argc, argv);
} }