08 September 2020, 21:46 | #21 | ||
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
Quote:
in zip-format the attributes are stored as 32-bit integer of which first 16 bits are used for dos and next 16 bits for amiga. Some of the compressors invert the bits, while some others store the attributes as is. (Does not make situation any better) For the filenotes, I would need to check again. I forgot which one I used earlier for my testing Quote:
The API/ABI could be something like this Code:
typedef int (*read_func)(void *dest, unsigned length, unsigned offset); /* assuming we do not have dynamic memory allocations the state would be allocated outside of the library, otherwise we can return it as void* */ int container_state_initialize(struct container *container_info,read_func reader,unsigned file_length); int container_get_file_size(struct container *container,const char *name); /* examine struct allocated by callee, null name for recursive read of everything */ int container_examine(FIB *dest,struct container *container,struct examine *examine,const char *name); int container_exnext(FIB *dest,struct examine *examine) /* file info allocated by callee */ int container_file_open(struct container *container,struct file *file,const char *name); /* length>file size to read a whole file i.e. 0xffffffff */ int container_file_read(struct file *file,void *dest, unsigned length, unsigned offset); I'll start looking the code I have. It is mostly in C++ so it needs bit work to translate into C. I can also do it in steps so we can see whether we are going to right directly i.e. I wont include compression first, but a plain container loading, then we can hopefully test. I can try to see if I can fit both lha/zip to the implementation since I have both at hand... |
||
10 September 2020, 01:20 | #22 | |||
Moderator
Join Date: Nov 2001
Location: Germany
Posts: 866
|
At the first implementation step this will be only called when the OS lives. So all system functions (V37+) can be used. This implies that this way files can be loaded and uncompressed only at startup via PreLoad or later via an OSSwitch. It maybe later desired to enable the possibility to PreLoad compressed data and to decompress it on demand when OS is disabled. This would then require a decompress routine when cannot use any OS resources. But I would leave that for later.
All memory needed to handle the archive should be allocated at initial opening the archive. Reading a file should not allocate memory. The PreLoad operation may consume nearly all free memory (a small amount is kept free). Quote:
Quote:
There should be one initial function which opens the archive and returns a allocated handle which contains all data for further calls. Close will free all resources. Code:
fs* fsOpen(const char * name, char ** errorstring); void fsClose(*fs); Code:
int error fsRead(*fs, const char * name, void *dest, unsigned length, unsigned offset); int error fsGetSize(*fs, const char * name, unsigned **length); Code:
/* this will check the name and allocate memory, returns 0=stop preload, -1=skip this file, memory to load file */ typedef int (*whdAllocFC)(const char * name, unsigned length); int error fsFileCache(*fs, whdAllocFC alloc); Code:
/* this will copy relevant data from the FIB to own memory, path is the relative path to FIB-object is located returns 0=stop function, -1=continue */ typedef int (*whdRegDC)(const char * path, FIB *fib); int error fsDirCache(*fs, whdRegDC reg); Quote:
It's also unclear when I can find time to make the necessary adaptions in WHDLoad. |
|||
10 September 2020, 21:54 | #23 | |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
Ok, I think I got it. I'll try to prototype something and I'll share the code when I have something presentable.
Quote:
I don't mind writing code that will be eventually useful, even though it takes time. |
|
22 September 2020, 23:19 | #24 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
ok, here is my humble proposal (It is still very much work in progress)
https://github.com/temisu/WHDLoadContainers Basically what it has is a simple API that only requires external memory allocation functions + defines for proper int type. Other than that it has zero dependencies (not even to standard libs). I also provided a simple test.c file to test it. Caveats:
In any case, at this point not a much of code is written so it is easier to see if I'm going to correct direction or not. Feedback is welcome. |
22 September 2020, 23:20 | #25 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
One more thing. For those wanting to test you need to archive with
lha -arz a archive.lha directory_to_arhive |
30 September 2020, 22:02 | #26 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
Hi,
Did you have a chance to look at it? Is the main structure ok? How is the API/ABI? Is it worth finishing in its current form? |
02 October 2020, 21:56 | #27 |
Moderator
Join Date: Nov 2001
Location: Germany
Posts: 866
|
Thanks for your work!
I have created two PRs to show my ideas regarding the API. |
04 October 2020, 16:22 | #28 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
|
09 October 2020, 23:04 | #29 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
Changed the api according to your ideas (hopefully)
I did not add any other features yet, not address the testing. I'm hoping we can agree on the API first. Also, currently the file reading and memory allocations are put into a single file (container_integration.c). It is very posix like and obviously needs more work. But if you think we are closer to truth here I can work it further |
25 October 2020, 22:43 | #30 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
I now updated the codebase with the support for zip, a better documentation and a test suite.
(The test suite is so far very unix-style coding but we have to start somewhere) Now, my plans next are: 1. Add decompression support. This will be useful mostly for the fileCache mode since seeking performance will be bad. 2. Create the enhancements for seeking plus the tooling required to go with it. This will be obviously a bit bigger bit of work and before I go there. I would like to have some feedback whether the code base is good enough for its intended usage |
29 October 2020, 20:21 | #31 |
Moderator
Join Date: Nov 2001
Location: Germany
Posts: 866
|
I have not deeply checked to all the source.
As long as the API is valid it will be ok I think. At some point it should be tested to build this for 68k. I would suggest vbcc. I will create a plugin interface for this in WHDLoad so you can then test this on your own. For container_getFileSize we still need a possibility to distinguish between a non-existing file and a file of size=0. Please see my patch. We maybe also need a support function which returns texts for the error codes of the API functions. |
30 October 2020, 13:54 | #32 | ||||
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
Quote:
Quote:
Quote:
Is this ok, or would you prefer some other approach? (Obviously this make the file size limit of 2G, but I don't see it as a big minus) Quote:
Code:
const char *container_getErrorString(int error_code) |
||||
02 November 2020, 14:06 | #33 | |
Moderator
Join Date: Nov 2001
Location: Germany
Posts: 866
|
Quote:
This is also fine |
|
12 November 2020, 22:39 | #34 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
After few gurus I got it also working in a classic. I did not test it though on 1.3, but I did not use anything that would prevent it for doing so.
Also added the missing bits and fixed few things. When you have idea what the plugin interface might look like I can try to build it f.e. .library or something |
15 November 2020, 23:41 | #35 |
Moderator
Join Date: Nov 2001
Location: Germany
Posts: 866
|
Kick 1.3 compatibility is not necessary because WHDLoad requires 2.0.
I created a assembler include file describing the file format and interface (see attachment). Maybe you add the relevant stuff to your container_api.h or add a new file. Please check and tell me if something is wrong or unclear. Deviations: I have used wvfs instead your 'container' as prefix because I'm not so lucky with container. I think it is more like a virtual filesystem. Just leave your container naming as it is. It doesn't make a difference. I have renamed 'examine' to dirCache. Maybe we need later a function to examine a single entry. So I think this is better. |
16 November 2020, 00:32 | #36 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
Hi,
Looks good. And naming change does not sound bad either (I have always been bad at naming things) - I can do a simple search and replace and use the new name everywhere. This way it does not get confusing in the future I'll see when I have something working that conform to the spec. It is almost like WHDLoad slave I see... |
17 November 2020, 22:33 | #37 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
Probably it is going to explode horribly. But I made a build...
https://github.com/temisu/WHDLoadArc...eases/tag/v0.2 Also, the makefiles are currently a mess. I need to clean them a bit so that others can build it if they want. Can I include the header file you sent to my repository as well, and if so, what is the license for it? |
18 November 2020, 21:07 | #38 |
Moderator
Join Date: Nov 2001
Location: Germany
Posts: 866
|
Thanks a lot
I will now make the changes in WHDLoad and do initial tests. Than will provide official beta. You may include it but it's anyway not used by your code. It will be part of the next WHDLoad release. Don't know about the licence.. |
03 January 2021, 13:57 | #39 |
Registered User
Join Date: Mar 2017
Location: Tallinn / Estonia
Posts: 74
|
Instead of opening a new thread I'm using this one instead.
We have a first pre-release of archive-loading for WHDLoad. Wepl made it as a modular feature so you need both a new WHDLoad and the extension in order to use it. You can get them here: http://whdload.de/whdload/whd187dev.lha https://github.com/temisu/WHDLoadArc...02/WHDLoad.VFS How to install? Copy the beta WHDLoad executable on top of the original WHDLoad, usually C: Download (or compile) the WHDLoad.VFS and copy it into the installation directory of WHDLoad, which is usually C: What the first release does? It allows preload of WHDLoad data-directory. Instead of pointing "Data" into a directory, it can point to an archive file. For slaves which saves savegames / high scores you also need to set "SavePath" since archive files are read only What are supported formats?
What are the practical formats? The most efficient format is uncompressed zip. Created with "-r0N" flags. Lha files although supported will incur a slow initialization delay since the file needs to be scanned from beginning to the end. Compression is supported but currently it is not optimized performance wise. What are the benefits? By using uncompressed zip-files the game startup is faster for those games using a lot of small files. What are the planned features? There is a lot of possibilities here. We can do improved progress display for loading. We can do on-demand decompression for cached files reducing the amount of memory needed for preload. Among other things. In short, we have not taken advantage of all the things we can for now. In any case I hope that people interested about the feature are happy to test it and give us feedback |
03 January 2021, 15:35 | #40 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,207
|
superb work. will improve speed even from winuae. and allows to store one archive per game. great
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Decompressing Shrinkler executables? | oRBIT | Coders. General | 3 | 08 February 2019 23:45 |
WHDLOAD not loading games | Taff64 | project.WHDLoad | 60 | 06 September 2011 08:22 |
Crash when loading anything with WHDload | KONEY | project.WHDLoad | 30 | 27 May 2010 20:58 |
Tower of Babel (demo) and Magic Fly - 3D games | Angus | Retrogaming General Discussion | 0 | 05 December 2007 11:22 |
Damn Mac games fly in Fusion!! | DDNI | Amiga scene | 1 | 04 June 2007 01:44 |
|
|