iConsoleInput and iConsoleOutput are now published in trunk as of
r31251. This change is scheduled to be merged into the 1.4 branch
(http://trac.crystalspace3d.org/trac/CS/wiki/Version14Plan), but
probably not the 1.2 branch since I do not think that there will be any
further 1.2 releases.

-- ES


Quentin Anciaux wrote:
> Ok I've found why the CS_QUERY_REGISTRY was failing... ConsoleInput and
> Output were not part of the defined interface in cspace.i (line 174).
> 
> Modifying it to this;
> 
> %define APPLY_FOR_EACH_INTERFACE
>  INTERFACE_APPLY(iBase)
>  INTERFACE_APPLY(iBinaryLoaderPlugin)
>  INTERFACE_APPLY(iBodyGroup)
>  INTERFACE_APPLY(iCamera)
>  INTERFACE_APPLY(iCameraPosition)
>  INTERFACE_APPLY(iCacheManager)
> *  INTERFACE_APPLY(iConsoleInput)
>  INTERFACE_APPLY(iConsoleOutput)
> *
> Did make the trick. The scfGetVersion used was false for these two
> interfaces, using the one from iBase instead.
> 
> Still I have the Cg error...
> 
> Regards,
> Quentin
> 
> 2008/9/23 Quentin Anciaux <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>:
>> Hi, by retrieving the console like this:
>>
>>        public static <T extends iBase> T CS_QUERY_REGISTRY(Class<T>
>> clazz,int major,int minor,int micro) {
>>                try {
>>                        iBase cons =
> cspace.getTheObjectRegistry().Get(clazz.getSimpleName());
>>                        int version = ((major << 24) | (minor << 16) |
> micro);
>>                        long id =
> iSCF.getSCF().GetInterfaceID(clazz.getSimpleName());
>>                        Object obj = cons.QueryInterface(id, version);
>>                        Field swigCPtr =
> obj.getClass().getDeclaredField("swigCPtr");
>>                        swigCPtr.setAccessible(true);
>>                        Constructor<?> constr =
>> clazz.getDeclaredConstructor(long.class,boolean.class);
>>                        constr.setAccessible(true);
>>                        @SuppressWarnings("unchecked")
>>                        T result = (T)
> constr.newInstance(swigCPtr.get(obj),false);
>>                        result.DecRef();
>>                        return result;
>>                }
>>                catch (Exception e) {
>>                        return null;
>>                }
>>        }
>>
>>        private void setupConsole() {
>>                this.conout = ACrystalspaceApplication.CS_QUERY_REGISTRY(
>>                                iConsoleOutput.class, 3, 0, 0);
>>                CDebug.assertNotNull(this.conout);
>>                this.conin = ACrystalspaceApplication.CS_QUERY_REGISTRY(
>>                                iConsoleInput.class, 2, 0, 0);
>>                CDebug.assertNotNull(this.conin);
>>                this.conin.Bind(this.conout);
>>                this.conin.SetPrompt("console>");
>>                this.conin.SetExecuteCallback(new csJExecCallback(
>>                                new CConsoleExecCallBack(this.conin,
> this.conout)));
>>        }
>>
>> It works... it's ugly but works, can there be a problem in the native
>> macro CS_QUERY_REGISTRY which prevent it to work correctly ?
>>
>> Now that the console works... I have another problem /o\... I can
>> activate it, it shows up correctly, type in thing in it... but
>> whenever I hit 'enter', the program stop with the following:
>>
>> (0) : fatal error C9999: *** exception during compilation ***
>> Cg compiler terminated due to fatal error
>>
>> I'm again lost... what does that mean ? The program runs with the
>> terrainf loaded.
>>
>> Than you,
>> Quentin
>>
>> 2008/9/22 Eric Sunshine <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>:
>>> It seems like it would be a good idea to open a bug report (ticket) at
>>> http://trac.crystalspace3d.org/trac/CS. Please include all of the
>>> information you have reported thus far in your emails.
>>>
>>> -- ES
>>>
>>> Quentin Anciaux wrote:
>>>> To prevent the crash, I've modified javapre.i line 197:
>>>>
>>>>     iBase * ibase = (iBase *)$1.Ref;
>>>>     void * ptr =
>>>> ibase->QueryInterface(iSCF::SCF->GetInterfaceID($1.Type), $1.Version);
>>>>
>>>> by
>>>>
>>>>     iBase * ibase = dynamic_cast<iBase *>((iBase *)$1.Ref);
>>>>     if (ibase != NULL) {
>>>>        void * ptr =
>>>> ibase->QueryInterface(iSCF::SCF->GetInterfaceID($1.Type), $1.Version);
>>>>        ...
>>>>     }
>>>>
>>>> This way it doesn't crash anymore... but still the console object is
> null...
>>>>
>>>> Quentin
>>>>
>>>> 2008/9/22 Quentin Anciaux <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>:
>>>>> Hi,
>>>>>
>>>>> I've narrowed the problem:
>>>>>
>>>>> Here is the generated JNI code for Query registry, the problem is that
>>>>> "iBase * ibase = (iBase *)(&result)->Ref;" is null...
>>>>> So it seems the query registry cannot find the plugin... but if I
>>>>> execute with verbose, it shows these lines:
>>>>>
>>>>>
> [EMAIL PROTECTED]:~/crystalspace/workspace/crystalspace-tutorial-map/run/bin$
>>>>> cat log.log | grep cscon
>>>>> SCF_NOTIFY: registering plugin
>>>>>
> /home/qan/crystalspace/workspace/crystalspace-tutorial-map/run/crystalspace/lib/crystalspace-1.2/csconout.so
>>>>> in context `{none}'
>>>>> SCF_NOTIFY: registering class crystalspace.console.output.standard in
>>>>> context `{none}' (from
>>>>>
> /home/qan/crystalspace/workspace/crystalspace-tutorial-map/run/crystalspace/lib/crystalspace-1.2/csconout.so)
>>>>> SCF_NOTIFY: registering plugin
>>>>>
> /home/qan/crystalspace/workspace/crystalspace-tutorial-map/run/crystalspace/lib/crystalspace-1.2/csconin.so
>>>>> in context `{none}'
>>>>> SCF_NOTIFY: registering class crystalspace.console.input.standard in
>>>>> context `{none}' (from
>>>>>
> /home/qan/crystalspace/workspace/crystalspace-tutorial-map/run/crystalspace/lib/crystalspace-1.2/csconin.so)
>>>>> SCF_NOTIFY: loading plugin
>>>>>
> /home/qan/crystalspace/workspace/crystalspace-tutorial-map/run/crystalspace/lib/crystalspace-1.2/csconin.so
>>>>> to satisfy request for csConsoleInput
>>>>> SCF_NOTIFY: loading plugin
>>>>>
> /home/qan/crystalspace/workspace/crystalspace-tutorial-map/run/crystalspace/lib/crystalspace-1.2/csconout.so
>>>>> to satisfy request for csConsoleOutput
>>>>>
>>>>> So why doesn't it work ? I've seen thread with the Warning: Suspicious
>>>>> but it is about multiple crystalspace install... But I've only one
>>>>> installation, and the CRYSTAL variable is set.
>>>>>
>>>>> Thanks for any help,
>>>>> Quentin
>>>>>
>>>>> generated JNI code:
>>>>> SWIGEXPORT jobject JNICALL
>>>>> Java_org_crystalspace3d_cspaceJNI_CS_1QUERY_1REGISTRY(JNIEnv *jenv,
>>>>> jclass jcls, jlong jarg1, jobject jarg1_, jstring jarg2) {
>>>>>  jobject jresult = 0 ;
>>>>>  iObjectRegistry *arg1 = (iObjectRegistry *) 0 ;
>>>>>  char *arg2 = (char *) 0 ;
>>>>>  int arg3 ;
>>>>>  SwigValueWrapper<csWrapPtr > result;
>>>>>  char className2[1024] ;
>>>>>
>>>>>  (void)jenv;
>>>>>  (void)jcls;
>>>>>  (void)jarg1_;
>>>>>  arg1 = *(iObjectRegistry **)&jarg1;
>>>>>  {
>>>>>    const char * s = jenv->GetStringUTFChars(jarg2, 0);
>>>>>    const char * dot = strrchr(s, '.');
>>>>>    strcpy(className2, "org/crystalspace3d/");
>>>>>    strcat(className2, dot?dot+1:s);
>>>>>    arg2 = className2 + sizeof("org/crystalspace3d/") - 1;
>>>>>    jenv->ReleaseStringUTFChars(jarg2, s);
>>>>>    jclass cls = jenv->FindClass(className2);
>>>>>    jmethodID mid = jenv->GetStaticMethodID(cls, "scfGetVersion",
> "()I");
>>>>>    arg3 = jenv->CallStaticIntMethod(cls, mid);
>>>>>  }
>>>>>  result = CS_QUERY_REGISTRY(arg1,(char const *)arg2,arg3);
>>>>>  {
>>>>>    iBase * ibase = (iBase *)(&result)->Ref;
>>>>>    if (ibase != NULL) {
>>>>>        void * ptr =
> ibase->QueryInterface(iSCF::SCF->GetInterfaceID((&result)->Type),
>>>>> (&result)->Version);
>>>>>        ibase->DecRef(); // Undo IncRef from QueryInterface
>>>>>        if (ptr == 0)
>>>>>        jresult = 0;
>>>>>        else
>>>>>        {
>>>>>        jlong cptr = 0;
>>>>>        *(void **)&cptr = ptr;
>>>>>        char cls_name[1024];
>>>>>        strcat(strcpy(cls_name, "org/crystalspace3d/"),
> (&result)->Type);
>>>>>        jclass cls = jenv->FindClass(cls_name);
>>>>>        jmethodID mid = jenv->GetMethodID(cls, "<init>", "(JZ)V");
>>>>>        jresult = jenv->NewObject(cls, mid, cptr, false);
>>>>>        }
>>>>>   }
>>>>>  }
>>>>>  return jresult;
>>>>> }
>>>>>
>>>>>
>>>>> 2008/9/20 Quentin Anciaux <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>>:
>>>>>> Hi,
>>>>>>
>>>>>> I try to add a console using the
>>>>>> http://www.crystalspace3d.org/main/Cimstep1 tutorial with crystalspace
>>>>>> 1.2.1 on an ubuntu 64. I'm using the csjava binding (so the code is in
>>>>>> java).
>>>>>>
>>>>>> I register the plugin with:
>>>>>>
>>>>>>                plugins.add(new csPluginRequest(
>>>>>>                              
>  "crystalspace.console.output.standard", "iConsoleOutput"));
>>>>>>                plugins.add(new csPluginRequest(
>>>>>>                              
>  "crystalspace.console.input.standard", "iConsoleInput"));
>>>>>>
>>>>>> But when in the program I do:
>>>>>>
>>>>>> this.conout = (iConsoleOutput)cspace.CS_QUERY_REGISTRY(cspace
>>>>>>                                .getTheObjectRegistry(),
> iConsoleOutput.class);
>>>>>>
>>>>>> I got the following in the console:
>>>>>>
>>>>>> WARNING! Suspicious: object with tag 'iConsoleOutput' does not
>>>>>> implement interface 'iConsoleOutput'!
>>>>>>
>>>>>> and the program crash with:
>>>>>>
>>>>>> #
>>>>>> # An unexpected error has been detected by Java Runtime Environment:
>>>>>> #
>>>>>> #  SIGSEGV (0xb) at pc=0x00007f980b75b96b, pid=29215, tid=1082800464
>>>>>> #
>>>>>> # Java VM: OpenJDK 64-Bit Server VM (1.6.0_0-b11 mixed mode
> linux-amd64)
>>>>>> # Problematic frame:
>>>>>> # C  [lib26687.so+0x1bd96b]
>>>>>> Java_org_crystalspace3d_cspaceJNI_CS_1QUERY_1REGISTRY+0x225
>>>>>> #
>>>>>> # An error report file with more information is saved as:
>>>>>> #
> /home/qan/crystalspace/workspace/crystalspace-tutorial-map/run/bin/hs_err_pid29215.log
>>>>>> #
>>>>>> # If you would like to submit a bug report, please visit:
>>>>>> #   https://bugs.launchpad.net/ubuntu/+source/openjdk-6/
>>>>>> # The crash happened outside the Java Virtual Machine in native code.
>>>>>> # See problematic frame for where to report the bug.
>>>>>> #
>>>>>> Aborted
>>>>>>
>>>>>> Same thing if trying to get ConsoleInput first.
>>>>>>
>>>>>> I did have to modify cspace.i to add ivaria/conin.h to get
>>>>>> ConsoleInput and also added an iConsoleExecCallback implementation in
>>>>>> java-post.i. But it crash well before adding the callback, it crash at
>>>>>> the query registry.
>>>>>>
>>>>>> Do you have an idea why it crash and or what means : Suspicious:
>>>>>> object with tag 'iConsoleOutput' does not implement interface
>>>>>> 'iConsoleOutput'!
>>>>>>
>>>>>> Thank you,
>>>>>> Quentin Anciaux
>>>>>>
>>>>>> --
>>>>>> All those moments will be lost in time, like tears in rain.
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> All those moments will be lost in time, like tears in rain.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Crystal-main mailing list
Crystal-main@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to