Recent

Author Topic: MultiFormat File - Simplest - Flexible  (Read 23994 times)

pixelink

  • Hero Member
  • *****
  • Posts: 1260
Re: MultiFormat File - Simplest - Flexible
« Reply #45 on: August 23, 2016, 03:28:29 pm »
Finding good code has been very challenging... not a lot out there.
And the docs are weak.

? Delphi has been around for 20+ years. BeginUpdateResource() has been in Windows since 2000.
ie: There is a ton of information. Available documentation and code has _never_ been better.

I think its a case of you thinking, "how do I" = "can someone code it for me, and I'll say I wrote it".

No... that is not me.
For me to learn, I have to see code to know how to apply it to what I want it to do.

Sorry... I don't know Pascal yet... it's just been 3 weeks   ... geeze   %)
Can't Type - Forgetful - Had Stroke = Forgive this old man!
LAZ 2.2.0 •  VSSTUDIO(.Net) 2022 • Win10 • 16G RAM • Nvida GForce RTX 2060

Fungus

  • Sr. Member
  • ****
  • Posts: 354
Re: MultiFormat File - Simplest - Flexible
« Reply #46 on: August 23, 2016, 03:40:21 pm »

I am talking about creating the Resource file as function in my already compiled EXE.
Am I missing something on that page?


If your resources should be embedded in an already compiled executable, the answer was given here: http://forum.lazarus.freepascal.org/index.php/topic,33763.msg219226.html#msg219226 and a working sample was given here: http://forum.lazarus.freepascal.org/index.php/topic,33763.msg219260.html#msg219260

To create your own resource file format which can hold different resource types you would use a TFileStream. How the data should be arranged in the file is up to you, the developer.

Handoko

  • Hero Member
  • *****
  • Posts: 5436
  • My goal: build my own game engine using Lazarus
Re: MultiFormat File - Simplest - Flexible
« Reply #47 on: August 23, 2016, 03:46:55 pm »
For me to learn, I have to see code to know how to apply it to what I want it to do.

Sorry... I don't know Pascal yet... it's just been 3 weeks   ... geeze   %)

Lazarus/FPC/Pascal is not hard. For learning reason, perhaps the thing you tried (multiformat file) is to complicated, it needs some advanced skills in several topics.

Here has good tutorials ranging from graphics to networking:
http://wiki.freepascal.org/Lazarus_Documentation

derek.john.evans

  • Guest
Re: MultiFormat File - Simplest - Flexible
« Reply #48 on: August 23, 2016, 04:08:33 pm »
For me to learn, I have to see code to know how to apply it to what I want it to do.
Sorry... I don't know Pascal yet... it's just been 3 weeks   ... geeze   %)

I get that. Just read what people write and respect peoples time.

FreePascal doesn't document platform dependent API's, which includes resource editing.
But, FreePascal does have TResourceStream for reading a resource. (examples online).

Therefore, you only need to research resource editing, and there is plenty of examples in all languages.

But, If you find researching resource editing difficult, then, it only gets harder. There are topics/api's which are truly hard to locate.

Remember. Editing a resource can be written in any language. There is no reason why you couldn't write a resource edit tool in C/C++/C#.


derek.john.evans

  • Guest
Re: MultiFormat File - Simplest - Flexible
« Reply #49 on: August 23, 2016, 04:16:30 pm »
Btw: On the multiFormat file question.

I'd use TUnZipper/TZipper in the unit Zipper. You get a multiformat stream with the added bonus of compression.

But.... Thats just me

balazsszekely

  • Guest
Re: MultiFormat File - Simplest - Flexible
« Reply #50 on: August 23, 2016, 04:34:23 pm »
@Geepster
I believe he wants to avoid the hard disk(otherwise there are much more easier solutions then resources). As far as I know, TZipper doesn't support extraction from resource to memory stream.

@Fungus
Your multi-platform solution(I just checked after you linked the post) will work fine under linux and windows, though in some cases will trigger AV response(windows). Under OSX, you can place all the files inside the bundle, no need to write to executable.

In my opinion, in this particular case(no res files involved, just binaries to read/write) there is no truly multi-platform solution. You can {ifdef} your unit if you like.

derek.john.evans

  • Guest
Re: MultiFormat File - Simplest - Flexible
« Reply #51 on: August 23, 2016, 04:36:30 pm »
@Geepster
I believe he wants to avoid the hard disk(otherwise there are much more easier solutions then resources). As far as I know, TZipper doesn't support extraction from resource to memory stream.

I had a look. TUnZipper has OnOpenInputStream & OnCreateStream to override the default TFileStream

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: MultiFormat File - Simplest - Flexible
« Reply #52 on: August 23, 2016, 04:36:58 pm »
How does MAC and Linux handle Resource Files?

As individual files, external to the executable. Here's Apple's docs:

https://developer.apple.com/library/ios/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html

With Linux, installing the app's .deb package (eg, on Ubuntu) would place the resource files in /usr/share/doc/progname, where progname is the name of your app.

Example: Every Mac comes with a chess app. This chess app's resource folder contains over 300 separate files.

 

TinyPortal © 2005-2018