SDraw Posted September 4, 2014 Share Posted September 4, 2014 Yes, title is dumb. Yes, someone will start to complain "Why do you need it?","You can do it with 'file<>' functions" and etc. But let me explain this. Just imagine, you made awesome terrain/city/(whatever) model, but you don't want others to use it. Solution? Encryption. There are a lot of methods of encryption (even you can make own). So, now you have encrypted model. And then pain in the ass starts. Decryption. You open encrypted file, read it all, decrypt data, save it to temporary file, use engineLoad<>. Ooops, temporary file is decrypted. Someone smart can use it. 1. Ok, let's delete file after importing. Do you think now your model is safe after that? Wrong. It's possible to prevent file deletion and successfully steal model. 2. Let's modify algorithm and put temporary file in random folder. Harder to locate temporary file, but still possible to steal. 3. We can remove encyption and rename file(s) as md5 hash without file type. Still not good. Why? DFF and TXD are connected with textures names, so it's simple to read all files and find similar textures. You can add more problems for thief and always create models with same textures names (wall.dff -> tex0,tex1,tex2; grass-> tex0; etc.), but it won't help. A bit of manual sorting and awesome model(s) is(/are) stolen. As you see, there is no perfect way to prevent model stealing. And I suggest to improve import functions: col engineLoadCOL ( string col_file, [ bool is_string = false ] ) dff engineLoadDFF ( string dff_file, int model_id, [ bool is_string = false ] ) txd engineLoadTXD ( string txd_file [, bool filteringEnabled = true, bool is_string = false ] ) Why? Just think. Get it? No? It's sad then. P.s. I can't create request on BT. It says "Access denied". Link to comment
Bonsai Posted September 5, 2014 Share Posted September 5, 2014 Why? Just think. Get it? No? It's sad then. Seems you are the only one you don't have to be sad about. Link to comment
DiSaMe Posted September 5, 2014 Share Posted September 5, 2014 Actually, the suggestion makes a lot of sense, even without considerations like "what it is useful for". It's more universal than loading from file because it not only can be used to replicate the same loading from file, but also do more. Whereas doing vice-versa (creating a file, writing the data and loading from that file) is more of a workaround way because it involves the task which is logically not necessary (writing the data from memory to file just to read it back from file to memory) and needlessly slower. Link to comment
cheez3d Posted September 6, 2014 Share Posted September 6, 2014 And this should also be available for dxCreateShader! Link to comment
ixjf Posted September 6, 2014 Share Posted September 6, 2014 I agree on this. However, I'd rather add new functions than adding an "is_string" parameter (or add a 'mode' parameter whose values could be either 'legacy' (default, current behavior) or 'raw'). Link to comment
Bonsai Posted September 6, 2014 Share Posted September 6, 2014 Ah I see, so this is more useful for e.g. multigamemode servers with custom downloaders etc.? Link to comment
qaisjp Posted September 7, 2014 Share Posted September 7, 2014 Or how about virtual ram disk: Creating files to a virtual ram disk: local f = File("$magic_fix.ext"); --$ symbol is for the ram disk f:write("magic contents"); f:close(); engineLoadTXD("$magic_fix.ext"); createShader("$magic_fix.ext"); This could open up many possibilities and allows faster temporary file manipulation. Link to comment
Recommended Posts