30

je viens de trouver les fonctions en question dans ext.asm, je vais voir si j'arrive à comprendre qqchose (bah voui avec un niveau comme le mien en asm C pas gagné!)

31

Extrait de la doc de RAMCALLS.TXT:
37-kernel::ExtractFromPack (Preos only)

Input:
a5 -> Ptr to pack archive (ptr to '68cA' signature)
d0.w = file index
Output:
d0.w = handle (Standard C function) or H_NULL
Destroy:
d0-d2/a0-a1 (Standard C funcion)

Extract the file d0 from the pack a5 calling the right library to extract it.
Use kernel::ExtractFile instead (High level function)

38-kernel::ExtractFile (Preos only)

Input:
a2 -> String name of the file (No folder)
Output:
d0.w = Handle or H_NULL (Standard C function)
Destroy:
d0-d2/a0-a1 (Standard C function)

Find the file a2 in all the Pack Archive files of the calculator.
If it is found, it is extracted by the right library.
It isn't added to the VAT.
It returns the created Handle which has to be free later.

The name is not limited to 8 bytes, and it can contains space, ...
But if it is the lenght of the string is > 8, you won't be able to
add it in the VAT (So you can not use it as library).
Only asm/c programs calling this function may access those files.

Example:
lea ziplib_str(Pc),a2
jsr kernel::ExtractFile
tst.w d0
beq error
...
ziplib_str dc.b "ziplib",0

39-kernel::ExtractFileFromPack (Preos 0.64 only)

Input:
a2 -> String name of the file (No folder)
d0.w = Handle of the Pack Archive
Output:
d0.w = Handle or H_NULL (Standard C function)
Destroy:
d0-d2/a0-a1 (Standard C function)

Find the file a2 in the specified Pack Archive file.
If it is found, it is extracted by the right library.
It isn't added to the VAT.
It returns the created Handle which has to be free later.

The name is not limited to 8 bytes, and it can contains space.
But if it is the lenght of the string is > 8, you won't be able to
add it in the VAT (So you can not use it as library).
Only asm/c programs calling this function may access those files.

Example:
move.w ...,d0 ; Handle of the file
lea comment_str(Pc),a2 ; We will extract file 'comment' from this pack
jsr kernel::ExtractFileFromPack
move.w d0,d5
beq error
DEREF d0,a0
addq.l #3,a0 ; a0 -> Comment of the pack archive
... ; some stuff
move.w d5,-(a7)
jsr tios::HeapFree ; Free the comment
addq.l #2,a7 comment_str dc.b "comment",0


prototypes extraits de kernel.h:

HANDLE kernel_ExtractFromPack(void *pack asm("a5"), short index asm("d0"));
HANDLE kernel_ExtractFile(const char *name asm("a2"));
HANDLE kernel_ExtractFileFromPack(HANDLE hd asm("d0"), const char *name asm("a2"));

Ca me parait assez clair:


- si tu veux un fichier qui s'appelle "truc" de n'importequelle pack archive:
HANDLE data;
data=kernel_ExtractFile("truc")


- si tu veux extraire le fichier "truc" d'un pack particulier:
HANDLE data;
HANDLE p;
.... // il faut mettre le handle du pack dans p
data=kernel_ExtractFromPack(p,"truc")

avatar

32

ExtractFromPack: on file l'handle d'une pack archive, l'index du fichier a decompresser, et cela renvoie l'handle du fichier.
ExtractFile: Recherche le fichier dans TOUS les pack archives, et l'extraict.
ExtractFileFromPack: Extrait le fichier dont le nom est specifie de la Pack Archive.