the blackbox SDK allows developers to load encrypted patches.
vvvv looks on startup if a certain 'Decrypt.dll' is in the '/bin' directory. if so, it loads the dll and links 4 methods the dll must provide:
begin //assign dll handle DLLHandle := LoadLibrary('..\Decrypt.dll'); if DLLHandle <> 0 then begin @Init := GetProcAddress(DLLHandle, 'Init'); @Decrypt := GetProcAddress(DLLHandle, 'Decrypt'); @Tick := GetProcAddress(DLLHandle, 'Tick'); @GetErrorString := GetProcAddress(DLLHandle, 'GetErrorString'); end; end;
the dll has to declare the functions as follows:
function Init: Integer; stdcall; begin //init decrytion system, called by vvvv only once on startup Result := 0; //tell vvvv everything is ok end; // check if still valid function Tick: Integer; stdcall; begin //this method is called every frame, so be very careful what you do here Result := 0; //the result of this method is the output of the Blackbox node end; // get the decrypted patch from file function Decrypt(const PFileName: Pointer; const FileNameLength: LongWord; PFileContent: Pointer): Integer; stdcall; var PDecrypted: PWidestring; filename: String; begin //cast the pointer content to a string filename := PString(PFilename)^; // try to open the file: // point to the mem location from the caller PDecrypted := PFileContent; //fill the memory location with a decrypted patch xml string PDecrypted^ := DecyptFile(filename); Result := 0; //values below 0 will cause an error and vvvv will display an error message end; // get the error string whenever Init or Decrypt return values below 0 function GetErrorString(PErrorString: Pointer): Integer; stdcall; var PString: PWidestring; begin Result := 0; try // point to the mem location from the caller PString := PErrorString; // assign memory PString^ := "your human readable error string"; except on E: Exception do Result := -100; end; end; //dont forget to export the methods exports Init, Decrypt, Tick, GetErrorString;
anonymous user login
~8d ago
~16d ago
~17d ago
~22d ago
~25d ago
~1mth ago
~1mth ago
~2mth ago
~2mth ago
~2mth ago