Demo Plugin Version.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/02/2010 at 16:05, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   11.5 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    I am trying to set up my plugin so that it works 100% in the DEMO version of C4D without having to be registered.

    Here's what I am trying.

      
      
      
    //SERIAL CODE/////////////////////////////////  
    //////////////////////////////////////////////  
      
    class PlanetXSerial : public SNHookClass  
    {  
      private:  
      const String title;  
      String name;  
      Bool sn_ok;  
      
    public:  
      
      PlanetXSerial() : title("Planet X Generator") {}  
      
      virtual LONG SNCheck(const String &c4dsn,const String &sn,LONG regdate,LONG curdate)  
      {  
          LONG err=0;  
            
          SerialInfo si;  
          GeGetSerialInfo(SERIAL_CINEMA4D, &si);           
          LONG mySN = si.nr.SubStr(6,5).StringToLong(&err);  
          LONG myAlgorithm = **REMOVED**  
          String mySerial = LongToString(myAlgorithm);  
      
          if (GeGetVersionType() == VERSION_DEMO)  
          {  
              GePrint("DEMO");  
              sn_ok = TRUE;  
              return SN_OKAY;  
          }  
          else  
          {  
              if (sn == mySerial)  
              {  
                  GePrint("LICENSED");  
                  sn_ok = TRUE;  
                  return SN_OKAY;  
              }  
              else  
              {  
                  GePrint("WRONG SERIAL");  
                  sn_ok = FALSE;  
                  return SN_WRONGNUMBER;  
              }  
          }  
      
      }  
      
      virtual const String& GetTitle()  
      {  
          return title;  
      }  
        
      Bool IsSerialOK() const { return sn_ok; }  
      
    };  
      
    PlanetXSerial *snhook = NULL;  
      
    Bool RegisterPlanetXSerial()  
    {  
      snhook = gNew PlanetXSerial;  
      return snhook->Register(ID_PLANET_OBJECT_SERIAL, SNFLAG_OWN);  
      return FALSE;  
    }  
      
    void FreePlanetXSerial()  
    {  
      if (snhook)  
          gDelete(snhook);  
    }  
      
    Bool IsSerialOKHook()  
    {  
      if (snhook)  
          return snhook->IsSerialOK();  
      
      return FALSE;  
    }  
      
    

    The problem is with what I have, is not allowing the plugin to be loaded in the DEMO version of C4D.   Does anyone see a problem with this setup?

    Thanks,

    ~Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 11/02/2010 at 23:46, xxxxxxxx wrote:

    Depending on which Cinema version you are using you have to check for VERSION_SAVABLEDEMO or VERSION_SAVABLEDEMO_ACTIVE instead of VERSION_DEMO.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/02/2010 at 06:40, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Depending on which Cinema version you are using you have to check for VERSION_SAVABLEDEMO or VERSION_SAVABLEDEMO_ACTIVE instead of VERSION_DEMO.

    And what is the exact dependency? From R11 on checking for these two instead of VERSON_DEMO? Is VERSON_DEMO completely gone now or should one still check for it? Thanks



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/02/2010 at 08:02, xxxxxxxx wrote:

    I changed the code to check for VERSION_SAVABLEDEMO || VERSION_SAVABLEDEMO_ACTIVE
    and it still does not show up in the demo version.    
    Any thoughts?
    ~Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/02/2010 at 08:02, xxxxxxxx wrote:

    hmm, it seems to me that the demo does not call SNCheck at all. Is that right? I installed the latest demo and it doesn´t seem to be called. Also a print to the console does not appear accordingly. If I´m right, what´s the right place to check for the demo? If I´m mistaken, it is strange as I am returning SN_OKAY if it´s the demo version but my plugin doesn´t appear in the menu (custom menu entry).

    thanks in advance



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/02/2010 at 08:53, xxxxxxxx wrote:

    I tried putting...

    if (GeGetVersionType() == VERSION_SAVABLEDEMO || VERSION_SAVABLEDEMO_ACTIVE)

    {
     if( !RegisterIsSerialOKHook()) return FALSE;
    }

    in the main.cpp   and still had no luck.  :)
    although if the demo doesn't call SNCheck at all then I suppose that wouldn't work then ...  LOL

    ~Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/02/2010 at 08:58, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    if (GeGetVersionType() == VERSION_SAVABLEDEMO || VERSION_SAVABLEDEMO_ACTIVE)

    Hi,

    in any case you should use GeGetVersionType() & VERSION_SAVABLEDEMO.  Not == because the returned LONG value is considered a bit field in this case not directly a digit (though it of course will still work but you are on the safe side this way).



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 12/02/2010 at 09:00, xxxxxxxx wrote:

    oh.. right .. thanks Katachi.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2010 at 06:02, xxxxxxxx wrote:

    Okay so I tried this in the main.cpp..

      
    Bool PluginStart(void)  
    {  
      // example of installing a crashhandler  
      old_handler = C4DOS.CrashHandler; // backup the original handler (must be called!)  
      C4DOS.CrashHandler = SDKCrashHandler; // insert the own handler  
      //GePrint("PLANET X GENERATOR IS AVAILABLE FOR DEMO USE ONLY!");  
        
          if (GeGetVersionType() &VERSION_SAVABLEDEMO_ACTIVE || VERSION_SAVABLEDEMO || VERSION_DEMO)  
          {  
              GePrint("PLANET X GENERATOR IS AVAILABLE FOR DEMO USE ONLY!");  
          }  
      
          else  
          {  
              GePrint("NOT THE DEMO");  
              GePrint("THE VERSION TYPE IS " + LongToString(GeGetVersionType()));  
              if (!IsSerialOKHook()) return FALSE; //don't load plugins if key is wrong      
          }  
      
      // Planet Object  
      if (!RegisterPlanet()) return FALSE;  
      // Sun Object  
      if (!RegisterSun()) return FALSE;  
      // Space Object  
      if (!RegisterSpace()) return FALSE;  
      //SERIAL NUMBER  
      if (!RegisterPlanetXSerial()) return FALSE;  
      
      return RegisterPlanet() && RegisterSun() && RegisterSpace();  
    }  
      
    

    When I am in the demo mode I get the plugin enabled and I am able to use it and as expected, the console prints out....

    PLANET X GENERATOR IS AVAILABLE FOR DEMO USE ONLY!

    However, when I am using my registered copy of the plugin, I am also able to use it and the console prints out...

    PLANET X GENERATOR IS AVAILABLE FOR DEMO USE ONLY!

    Why do you think this is happening?

    ~Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2010 at 07:01, xxxxxxxx wrote:

    Well...  thanks to a heaping helping of kindness from Cactus Dan,  this problem has been solved.   Here's the final working code for the PluginStart();

      
    Bool PluginStart(void)  
    {  
      // example of installing a crashhandler  
      old_handler = C4DOS.CrashHandler; // backup the original handler (must be called!)  
      C4DOS.CrashHandler = SDKCrashHandler; // insert the own handler  
      //GePrint("PLANET X GENERATOR IS AVAILABLE FOR DEMO USE ONLY!");  
        
          if(GeGetVersionType()&VERSION_SAVABLEDEMO_ACTIVE || GeGetVersionType()&VERSION_SAVABLEDEMO || GeGetVersionType()&VERSION_DEMO)  
          {  
              GePrint("PLANET X GENERATOR IS AVAILABLE FOR DEMO USE ONLY!");  
          }  
      
          else  
          {  
              GePrint("NOT THE DEMO");  
              GePrint("THE VERSION TYPE IS " + LongToString(GeGetVersionType()));  
              if (!IsSerialOKHook()) return FALSE; //don't load plugins if key is wrong      
          }  
      
      // Planet Object  
      if (!RegisterPlanet()) return FALSE;  
      // Sun Object  
      if (!RegisterSun()) return FALSE;  
      // Space Object  
      if (!RegisterSpace()) return FALSE;  
      //SERIAL NUMBER  
      if (!RegisterPlanetXSerial()) return FALSE;  
      
      return RegisterPlanet() && RegisterSun() && RegisterSpace();  
    }  
    


  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2010 at 07:31, xxxxxxxx wrote:

    The line looks strange to me:

    GeGetVersionType() &VERSION;_SAVABLEDEMO_ACTIVE || VERSION_SAVABLEDEMO || VERSION_DEMO
    

    Shouldn't it be:

    GeGetVersionType() == VERSION_SAVABLEDEMO_ACTIVE || VERSION_SAVABLEDEMO || VERSION_DEMO
    

    [EDIT]Oh no, wait. Forget about this. & is correct.[/EDIT]

    Cheers,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2010 at 07:33, xxxxxxxx wrote:

    Actually, that looks strange to me, too:

        // Planet Object   
        if (!RegisterPlanet()) return FALSE;   
        // Sun Object   
        if (!RegisterSun()) return FALSE;   
        // Space Object   
        if (!RegisterSpace()) return FALSE;   
        //SERIAL NUMBER   
        if (!RegisterPlanetXSerial()) return FALSE;   
      
        return RegisterPlanet() && RegisterSun() && RegisterSpace();   
    

    So, you first try to register the plugins. When this succeeds, you register them all again and return the result? Why don't you just return TRUE at the end of the function, since they're already registered?

    Cheers,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2010 at 07:45, xxxxxxxx wrote:

    so instead of

    return RegisterPlanet() && RegisterSun() && RegisterSpace();  
    

    do...

    return TRUE;  
    

    ?

    ~Shawn



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2010 at 09:53, xxxxxxxx wrote:

    GeGetVersionType() returns a bit mask. So you have to check against your own bit mask.

    Remember that || and & & are compare operators.
    | and & are bit mask operators.

    Following line of code checks if the result of GeGetversionType() has one of the specified bits set.

      
    if (GeGetVersionType() & (VERSION_SAVABLEDEMO_ACTIVE | VERSION_SAVABLEDEMO | VERSION_DEMO))  
    {  
      //do something  
    }  
    

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 13/02/2010 at 14:57, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    so instead of

    return RegisterPlanet() && RegisterSun() && RegisterSpace();
    do...

    return TRUE;
    ?

    Yes. You have already called all Register functions before, so if the function reaches this point, you can just return TRUE. If one of the Register functions does not work out (returns FALSE) the PluginStart function is cancelled anyway and FALSE is returned.

    Cheers,
    Jack



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/02/2010 at 02:00, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    And what is the exact dependency? From R11 on checking for these two instead of VERSON_DEMO? Is VERSON_DEMO completely gone now or should one still check for it? Thanks

    VERSION_DEMO is not used anymore since the R11 demo version.

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/02/2010 at 02:07, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    hmm, it seems to me that the demo does not call SNCheck at all. Is that right?

    The demo version doesn't support the SNHookClass because it has no Personalioze dialog anyway.

    Check in C4DPL_INIT_SYS for the Cinema version (that's where you would register the SNHookClass too).

    cheers,
    Matthias



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/02/2010 at 04:18, xxxxxxxx wrote:

    Thanks Matthias.


Log in to reply