Simple copy protection done right :)
-
welp. im guessing simple copy protection is broken or depreciated in current HISE
worked like a charm since 2020 now...
it registers license keys does everything right then...when recompiled or reopened it says invalid serial even though it is in the registration file and said it was correct initially
Interface: Checking serial Interface: Restored serial: 4E6I-52DH-17X1-OE54 Interface: Interface: Invalid serial number
in fact it doesnt even look like its checking it after restoring basic on what the console is saying there.
again this is the exact code. exact implementation as above..worked for years now it doesnt for some reason
all gui elements are created and match changed GlobalMute to Mute for an audio mute opposed to midinamespace Authorisation { const var SerialInput = Content.getComponent("SerialInput"); const var Description = Content.getComponent("Description"); const var AuthorisationDialogue = Content.getComponent("AuthorisationDialogue"); const var Mute = Synth.getEffect("Mute"); /** Checks if the serial input is valid and stores the result if successful. */ inline function onSubmitButtonControl(component, value) { if(!value) // Just execute once return; local v = SerialInput.getValue(); Console.print(v); // Checks if it's in the input if(serials.Data.contains(v)) { Console.print("Serial number found"); local data = { "Serial": v }; // Stores the file to the hard drive. In HISE it will be the project folder // but in the compiled plugin it will use the parent directory to the // user preset directory (which is usually the app data folder). Engine.dumpAsJSON(data, "../RegistrationInfo.js"); setValidLicense(true); } else { Console.print("Invalid serial number"); Description.set("text", "Invalid serial number. The number you supplied does not match"); setValidLicense(false); } }; Content.getComponent("SubmitButton").setControlCallback(onSubmitButtonControl); inline function setValidLicense(isValid) { // Do whatever you want to do here. I suggest a MIDI muter... Mute.setBypassed(value - isValid); if(isValid) { // Change this to any other visual indication... AuthorisationDialogue.set("visible", false); } else { AuthorisationDialogue.set("visible", true); } } inline function checkOnLoad() { // Clear the input SerialInput.set("text", ""); // Load the serial from the stored file local pData = Engine.loadFromJSON("../RegistrationInfo.js"); Console.print("Checking serial"); if(pData) { local v = pData.Serial; Console.print("Restored serial: " + v); if(serials.Data.contains(v)) { setValidLicense(true); return; } } setValidLicense(false); } // Call this on startup checkOnLoad(); }
-
@mwplugs haha i figured out something really weird...
so i look in the sample project etc. and reference times it has worked right.
but i discovered that for some reason now..when the submit button has save in preset enabled the whole script doesnt work. although previously it didnt matter but now it does. so if anyone runs into that take a look
-
@mwplugs Hi, so I should deactivate the saveInPreset on the Submit button to make it fully work?
-
@mwplugs Ok so, when I opened the snippet, the button is already not set as saveInPreset, and it work like a charm.
I don't know how happened to not work on your side. -
This post is deleted! -
Trying to run this but I get this when it loads:
-
@Sampletekk
The project no longer works like this. You have to copy the code and set it up yourself. Then it will work.I did this some time ago. You can download it here (You must download it within 7 days, otherwise the link will expire!):
-
This post is deleted! -
Struggeling with this! When I run the program now, I'm getting this:
Any ideas?
-
@Sampletekk Unknown function mean the thing on the left side of the
.
doesn't have a function with that name - so you need to check thatserials.Data
has the values you think it should. -
@d-healey said in Simple copy protection done right :):
@Sampletekk Unknown function mean the thing on the left side of the
.
doesn't have a function with that name - so you need to check thatserials.Data
has the values you think it should.Aha! The file created, that contains the valid numbers, is called "serials.js". Is this the problem here?
-
@Sampletekk said in Simple copy protection done right :):
Is this the problem here?
I don't know, I'm not familiar with the rest of the code.
-
Ok, I've got this working! One question: When working in the Hise, after entering a valid serial, The script creates the file "RegistrationInfo.js" in the projects root.
Where does that file end up when you are working with a compiled version? I'm on a mac now, but I'm also interested in knowing where it is on a PC.
For testing purposes, I would like to be able to "reset" the registration for the compiled versions, as I would do while developing, by deleting the "RegistrationInfo.js" file -
@Sampletekk try looking in the App Data folders...
-
@Lindon said in Simple copy protection done right :):
@Sampletekk try looking in the App Data folders...
Found it, on a mac, it was in the "Application Support" folder!
-
@Sampletekk yep - and on windows its in
C:/Users/AppData/Roaming/CompanyName/productName