Colore - C# Library for Chroma

Discussion in 'Razer Chroma' started by BrandonJCScott, Mar 8, 2015.

Thread Status:
Not open for further replies.
  1. Zalmez

    Zalmez New Member

    Here's the script aswell, I made a new script just for testing so not the optimal programming in there yet x3

    Code:
    using System.Collections;
    using Corale.Colore.Core;
    
    public class KeyboardManager {
    
        // Use this for initialization
        void Start () {
            KeyboardColor();
        }
       
        // Update is called once per frame
        void Update () {
       
        }
    
    
        public void KeyboardColor()
        {
            var keyboard = Keyboard.Instance;
    
            keyboard.Set(Color.Blue);
        }
    
    }
    
     
  2. Sharparam

    Sharparam Member

    Ah yes, my bad. Colore is targeting v4.5. You could try with the different platform DLLs, but the error doesn't seem related to that. I'm not sure how references are handled in Unity as I've never done extensive work with it. The version difference could have something to do with it though. Have you followed their guide for adding managed DLLs? From what I gathered, the "plugins" folder is not for managed code.
     
  3. Zalmez

    Zalmez New Member

  4. Sharparam

    Sharparam Member

    There are still some internal issues about project management to be resolved before we settle on what kind of documentation tool to use for Colore, so for now you'll have to browse via IntelliSense. Once summer hits and my exams are done I'll have more time to work out a good solution :)
     
  5. Zalmez

    Zalmez New Member

    ok, thanku for answering. good luck with your exams!
     
  6. The wrapper needs to be updated since it's not working anymore with newer versions or the recent version (0.2.4) of the sdk.
     
  7. Sharparam

    Sharparam Member

    Are you getting any errors? I looked through a fresh download of the docs and I didn't see anything changed (I'm on phone though so I might've missed something). Perhaps Razer hasn't updated the docs, wouldn't really surprise me.
     
  8. Yes, you get an exception when you try to call 'Keyboard.Instance'. When you use an older version like 0.1.8, it's working fine. I didn't want to use an old sdk, so i switched to native code but if you are able solve the problem, i'll switch over again.

    _______________________________________________
    Unhandled Exception: System.TypeInitializationException: Der Typeninitialisier
    er für "Corale.Colore.Razer.NativeMethods" hat eine Ausnahme verursacht. ---> Co
    rale.Colore.ColoreException: Failed to dynamically load function, GetProcAddress
    returned NULL for CreateMouseCustomEffects
    bei Corale.Colore.Razer.NativeMethods.GetDelegateFromLibrary[T](IntPtr lib, S
    tring name)
    bei Corale.Colore.Razer.NativeMethods..cctor()
    --- Ende der internen Ausnahmestapelüberwachung ---
    bei Corale.Colore.Core.NativeWrapper.Init()
    bei Corale.Colore.Core.Keyboard.get_Instance()
    _________________________________________________

    As you can see the exception is triggered by a faulty return value of the GetProcAddress function when you try to obtain the functions of the Chroma SDK. As far as i can judge the situation you try to find a function that does not exist (anymore). The latest documentation of the sdk is for version 0.2.3 and the functions that exist for now are only the following:

    RZRESULT Init (void)
    RZRESULT UnInit (void)
    RZRESULT CreateEffect (RZDEVICEID DeviceId, ChromaSDK::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId)
    RZRESULT CreateKeyboardEffect (ChromaSDK::Keyboard::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId)
    RZRESULT CreateKeyboardCustomEffects (RZSIZE NumEffects, ChromaSDK::Keyboard::CUSTOM_KEY_EFFECT_TYPE CustomEffects[MAX_CUSTOM_EFFECTS], RZEFFECTID *pEffectId)
    RZRESULT CreateKeyboardCustomGridEffects (ChromaSDK::Keyboard::CUSTOM_GRID_EFFECT_TYPE Effects, RZEFFECTID *pEffectId)
    RZRESULT CreateMouseEffect (ChromaSDK::Mouse::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId)
    RZRESULT CreateHeadsetEffect (ChromaSDK::Headset::EFFECT_TYPE Effect, PRZPARAM pParam, RZEFFECTID *pEffectId)
    RZRESULT DeleteEffect (RZEFFECTID EffectId)
    RZRESULT SetEffect (RZEFFECTID EffectId)
    RZRESULT RegisterEventNotification (HWND hWnd)
    RZRESULT UnregisterEventNotification ()

    Here you can see that 'CreateMouseCustomEffects' does not exist. This explains the exception caused by the return value NULL.

    So yeah.. they changed the api but forgot to update their documentation 'cause if you download the documentation via the link provided for the documentation on razers website you get a really old one that fits to version 0.1.6.
     
  9. Sharparam

    Sharparam Member

    Thank you for the detailed report! Where did you get that list of API functions? I'm getting home later today so then I'll be able to update everything according to the new API.
     
  10. No problem, I think this should help resolve the problems quickly.

    You can find the Exported APIs in the RzChromaSDK.h Reference File.

    Just download the latest beta sdk setup. It comes bundled with the documentation for v. 0.2.3. Sometimes i ask myself why others can't do their job right. It's very easy to update the link for the recent documentation, why they didn't do it? But it's not just razer. Such annoying things I encounter very often the last time.

    Another point is: If razer had thought out their software a little better, I wouldn't have faced the chroma sdk by now.
     
  11. njbmartin

    njbmartin Developer of Awesome

    As you said, the latest SDK (0.2.3) is a beta, the documentation on the site therefore hasn't been updated yet as this version of the SDK is subject to change.
     
  12. If you open the download page (http://developer.razerzone.com/chroma/download/), you'll notice that there are 2 download options available: API Description Guide & SDK.

    The point is that you download the documentation for v0.1.6 by clicking on Download below API Description Guide and get the SDK v0.2.4 by clicking on Download below SDK.

    Anyway that is not the topic of this thread. The author of Colore now knows what he has to change to make his Wrapper compatible to the recent version.
     
  13. Sharparam

    Sharparam Member

    Most of it should be ready for the new version of the SDK now. The changes can be seen on the feature/sdk-2.0-support branch of my repo for now.

    You can grab that code and compile it and see if it works with the new SDK (I still don't have access to a Chroma keyboard or other device so I can't test it on a physical device myself).

    Once I've cleaned everything up and made sure it's up to standards I'll see to integrating it to the main repo and pushing v2.0.0 of Colore to the public!
     
    njbmartin likes this.
  14. Great! I would really appreciate that.

    Thumps up for your work.

    I'm creating an enhanced lightning manager in c# with real multiple layers support and triggering / toggling function. My quick and dirty workaround for the moment was 2 applications: the manager written in c# passing over the grid to the keyboardhandler that is written in c++ to communicate directly with the sdk. But if you're about to push out a new version (nuget! nuget! nuget! :D), i'll change to the implemented wrapper.
     
  15. DQKev

    DQKev Member

     
  16. njbmartin

    njbmartin Developer of Awesome

    As always, great work!
     
  17. First of all, thanks for putting together a .net library!

    The version of the SDK on razer is v0.2.4 and I am unable to get any of the versions of Colore to work with it. I tried a few github branches and forks and they always complain about an invalid memory read or something (I didn't capture the exact error).

    I did find a version of the v0.1.8 SDK and install it and used the version of Colore in NuGet and that works, but it doesn't seem to work with the Naga Chroma mouse. It won't change colors.
     
  18. njbmartin

    njbmartin Developer of Awesome

    Naga Chroma is definitely not supported yet.
     
  19. Sharparam

    Sharparam Member

    Did you try the feature/sdk-2.0-support branch? Also, please post the full error. Perhaps they have made additional changes to the SDK again. It's still marked as beta on their site last I checked, so it may be changing a lot.
     
  20. I did. I tried it again against v0.2.4 and with both an ANY_CPU and X64 build.

    I uninstalled v0.18, then installed v0.2.4 and then ran the Enabled SDK support.reg file.

    Corale.Colore.Core.Keyboard.Instance.Set(Corale.Colore.Core.Color.Red);

    This was with VS 2013 running "as administrator".

    Code:
    Additional information: Call to native Chroma SDK function SetEffect failed with error: RzAccessDenied: Access denied. (5)
    
       at Corale.Colore.Core.NativeWrapper.SetEffect(Guid guid) in d:\Data\Downloads\Colore-feature-sdk-2.0-support\Colore-feature-sdk-2.0-support\Corale.Colore\Core\NativeWrapper.cs:line 313
       at Corale.Colore.Core.Device.Set(Guid guid) in d:\Data\Downloads\Colore-feature-sdk-2.0-support\Colore-feature-sdk-2.0-support\Corale.Colore\Core\Device.cs:line 70
       at Corale.Colore.Core.Keyboard.Set(Color color) in d:\Data\Downloads\Colore-feature-sdk-2.0-support\Colore-feature-sdk-2.0-support\Corale.Colore\Core\Keyboard.cs:line 202
       at ConsoleApplication1.Program.Main(String[] args) in d:\Data\Downloads\Colore-feature-sdk-2.0-support\Colore-feature-sdk-2.0-support\ConsoleApplication1\Program.cs:line 13
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
    
     
Thread Status:
Not open for further replies.
Sign In with Razer ID >


Don't have a Razer ID yet?
Get Razer ID >