I need to create Datatype descriptor which relies on a function to indentify the file being opened.
DTDesc from teh DevCD DSIs for me (when loading an existing descriptor anyway).
I doenloaded dtmake from aminet and those tools can read "disassemble" and create the new descriptor, but I'm unsure of how to compile the function element so that it works.
On OS4 can it be PPC or 68k code or either?
The original I'm upgrading was 68k so I compiled the fixed (I hope) code with m68k-amigaos- ggc but the resultant descriptor crashes.
Comparing with the original it looks like gcc has placed the strings before the function so that it's not the first thing in the linked object.
My options were
m68k-amigaos-gcc -nostartfiles -nostdlib -noixemul desc_func.c -o DT.drec
Managed a viable build by compiling to an assembler file and editing the assembler to moc the string definitions to the end, then compiling / linking with nostartfiles et al....
Must be better way?
I once developed a DataType for the Kodak Photo CD image format, have a look at OS4Depot, source and everything else included in the LhA archive.
It may be of help.
@Massi
Thanks, but as your descriptor doesn't have function, it's doesn't help me work out the best way of compling the descriptor function. :-)
Just write a _start() function in C like:
and compile it into an ELF file with ppc-amigaos-gcc -nostartfiles.
The return value should be TRUE if the file is a match and FALSE if it's not.
IExec, IDOS and IUtility interface pointers are available in the DTHookContext structure.
I must confess I don't understand this whole datatypes function business. The wiki says, "A Function is a stand-alone executable", which must be compiled as salass00 has explained above. But where is the executable supposed to be placed on disk, and how is it referred to by the descriptor?
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2
@trixie >
The old "DTDesc" utility from the OS3 developer CD's might have crashed for broadblues when loading an existing descriptor but it does work to create a descriptor from example files. When I used it to create a new descriptor for example 8SVX files and added a function, it embedded the function in the descriptor. The function I used to create the descriptor was just an old OS3 (68k) AmigaDOS command which would not actually work but it was embedded in the descriptor produced by "DTDesc".
X1000 - OS 4.1FE
@trixie
You're not supposed to install the executable anywhere. You just reference it from your #?.desc file which you then pass to dtdesc or MakeDT.rexx to generate the descriptor file.
The MakeDT.rexx script and dtdesc store the executable inside an IFF chunk in the descriptor file.
MakeDT.rexx is used to generate most, if not all of the AmigaOS 4.x datatype descriptors so that's the one I would recommend to use.
The MakeDT.rexx archive, which I linked above, also includes documentation on how you should write your .desc file.
@salass00, xenic
Thank you both. I had better find some time to update the relevant section in the Dev Wiki.
AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2