Creating datatypes descriptor and compiing the Function

9 posts / 0 new
Last post
broadblues
broadblues's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2012-05-02 21:48
Creating datatypes descriptor and compiing the Function

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

broadblues
broadblues's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2012-05-02 21:48
Re: Creating datatypes descriptor and compiing the Function

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?

Massi
Massi's picture
Offline
Last seen: 4 years 6 months ago
Joined: 2012-03-28 17:16
Re: Creating datatypes descriptor and compiing the Function

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.

broadblues
broadblues's picture
Offline
Last seen: 4 years 9 months ago
Joined: 2012-05-02 21:48
Re: Creating datatypes descriptor and compiing the Function

@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. :-)

salass00
salass00's picture
Offline
Last seen: 6 months 1 week ago
Joined: 2011-02-03 11:27
Re: Creating datatypes descriptor and compiing the Function

Just write a _start() function in C like:

  1. BOOL _start (struct DTHookContext *dthc) {
  2. /* ... */
  3. }

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.

trixie
trixie's picture
Offline
Last seen: 6 months 3 weeks ago
Joined: 2011-02-03 13:58
Re: Creating datatypes descriptor and compiing the Function

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

xenic
xenic's picture
Offline
Last seen: 2 years 7 months ago
Joined: 2011-05-07 04:52
Re: Creating datatypes descriptor and compiing the Function

@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

salass00
salass00's picture
Offline
Last seen: 6 months 1 week ago
Joined: 2011-02-03 11:27
Re: Creating datatypes descriptor and compiing the Function

@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.

trixie
trixie's picture
Offline
Last seen: 6 months 3 weeks ago
Joined: 2011-02-03 13:58
Re: Creating datatypes descriptor and compiing the Function

@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

Log in or register to post comments