Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How access to resource from DLL or resource package from SFML  (Read 9894 times)

0 Members and 1 Guest are viewing this topic.

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #15 on: November 18, 2014, 09:39:46 pm »
Yes normal run my SFML2.1 test game engine.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How access to resource in DLL from SFML
« Reply #16 on: November 18, 2014, 09:50:13 pm »
And the examples that you download with SFML? OpenGL, Pong, Shader, etc... Do they work flawlessly too?

If so, then it's a configuration problem. Make sure that the .dll files match the compiled .lib libraries for both Thor and SFML. Compile both projects with exactly the same configurations, settings and compiler flags. And most important: read the tutorial very carefully. You say the problem appears also when you use latest SFML and latest Thor revisions? Check if there are no old SFML/Thor versions left on your computer that are used accidentally.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #17 on: November 18, 2014, 09:54:01 pm »
Damn(sry), maybe I found problem.

Its SFML2.1 > Visual C++ 9 (2008) - 32 bits
I dl exactly this ver.

And because Aurora using at least Visual C++ 10 (2010) need the same.

Try this now.

Yes it was problem - successfully runs now!))).


« Last Edit: November 18, 2014, 10:20:28 pm by Redee »

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #18 on: November 19, 2014, 10:14:05 pm »
Ok, I read tutorial where explains about resources from files.
http://www.bromeon.ch/libraries/thor/v2.0/tutorial-resources.html

But me need get resource from file in some resource package  / DLL.

Any ideas to do this?

In game Zloxx v2.2
http://www.bromeon.ch/games/zloxx/index.html
we can see resource files > *.zlx
For example in Resources2.zlx a lot of *.png

Exactly it me need - like in game Zloxx for windows.
Compiling images / sounds to resource file and access from him.
« Last Edit: November 19, 2014, 10:55:50 pm by Redee »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How access to resource in DLL from SFML
« Reply #19 on: November 19, 2014, 11:03:58 pm »
Good to hear that it runs :)

This is usually done in archive files. What they do is packing multiple files into a single one. There are already many existing formats like tar. Sometimes they are coupled with compression and/or encryption. For an overview, see this Wikipedia article.

You also need C or C++ libraries that support such formats. PhysicsFS is such an example.
« Last Edit: November 19, 2014, 11:05:50 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource in DLL from SFML
« Reply #20 on: November 20, 2014, 12:43:12 pm »
Thank You for advices.
Many information need read else.
Its make my life harder).

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource from DLL or resource package from SFML
« Reply #21 on: November 21, 2014, 10:35:46 pm »
Ok I completely read PNG file from ZIP and parse to SFML Image object using PhysicsFS 2.0.3
But... Its still accessible.
Need encryption with encryption catalogs and filenames.

Ok, we see PhysicsFS 2.1.0 support *.7z archives, which can do this.
http://icculus.org/physfs/docs-devel/html

Quote
Currently supported archive types:

    .ZIP (pkZip/WinZip/Info-ZIP compatible)
    .7Z (7zip archives)
    .ISO (ISO9660 files, CD-ROM images)
    .GRP (Build Engine groupfile archives)
    .PAK (Quake I/II archive format)
    .HOG (Descent I/II HOG file archives)
    .MVL (Descent II movielib archives)
    .WAD (DOOM engine archives)

Anyone knows - PhysicsFS 2.1.0 have access to *.7z with encryption password ?
I no see any function to do this.

Or me better use some unique Archive with reading Library for C++ ?

Now searching for information how more protect and block access to renamed zip files.
Maybe we can hardcodes - add some symbols to begin of archives ?
And access to archives skipping this symbols ?

But I think will be good use some 7z load Library for C++ which can do encryption access.
I read - in many sites says - PhysFS can't read archives with encryption.

Maybe good way use Crypto++ ?
Then question how read zip from memory using PhysFS ?

How about LZMA SDK ?
http://www.7-zip.org/sdk.html
Hmmmm, no solution for Visual Studio build.

Some answer at
http://stackoverflow.com/questions/18943794/compiling-lzma-sdk-in-c-creates-a-lib-and-i-want-a-dll-how-can-i-do-this

Will try do this later. A bit tired to search solutions.
« Last Edit: November 21, 2014, 11:41:30 pm by Redee »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How access to resource from DLL or resource package from SFML
« Reply #22 on: November 24, 2014, 02:19:19 am »
Anyone knows - PhysicsFS 2.1.0 have access to *.7z with encryption password ?
I no see any function to do this.
The last time I tried, this was not possible. I doubt this has changed meanwhile.

How about LZMA SDK ?
http://www.7-zip.org/sdk.html
You don't want to use that. It's one of the ugliest C++ APIs I have ever seen, especially given its widespread use. At that time, the documentation was limited to one example code (the 7Zip application itself), which makes it very funny to figure things out. There is almost no abstraction, as a user you need to know how the algorithm works and deal with tedious low-level tasks like buffer allocations.

I can really not recommend using the LZMA functions directly. You're much better off writing an API to the 7Zip command line interface (which is far more intuitive). You can still do that through C++ code, just write functions that forward the CLI arguments to the 7Zip application ;)

Maybe we can hardcodes - add some symbols to begin of archives ?
And access to archives skipping this symbols ?
If you don't need compression, you can build a format yourself. It takes some work, but if you have experience with binary file reading/writing, it should be doable. If you don't, then learn it first, because debugging binary data is not too funny.

What you can do is have a index at the beginning of the file. In that index you store a resource name and its address within the file (i.e. number of bytes from the beginning). Every such entry has a fixed size, so you know where to look. The whole index can either be fixed-size or resizable, in the latter case you need to move the binary data within the archive, if there is no more space for the index entries.

Maybe good way use Crypto++ ?
Do you really need that sophisticated level of encryption? Just keep in mind that you will store the key somewhere in your executable or an external file, so an attacker is potentially able to gain access, regardless of your efforts. Considering that, you could also try something simpler like XOR... what do you need to encrypt?
« Last Edit: November 24, 2014, 02:20:50 am by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Redee

  • Jr. Member
  • **
  • Posts: 97
    • View Profile
Re: How access to resource from DLL or resource package from SFML
« Reply #23 on: November 24, 2014, 04:00:55 pm »
Great responds!
I see encryption is no good solution and very vulnerable.
Case with build own format with read/write library looks pretty >Nice< but no way exactly for me - no enough level of C++.
Yes, extra symbols in archive bad decision too.

My main goal - protect resources from players / users, who tries simply rename to zip / rar and get access from TotalCommander for example. To see levels / bosses / abilities / textures / etc...
And encryption can be effective shield.
I no care about encryption key, its only to basic protect.
If they will know about key - they will )).

Ok, we have 7z resource archive package with AES-256 encryption with hide tree of catalogs and files.
Need C++ library to access to 7z archive (read from him).
Or access to resources to another archive format which do encryption with hide files and directories.
« Last Edit: November 24, 2014, 04:17:59 pm by Redee »

 

anything