• MorphOS Developer
    Piru
    Posts: 576 from 2003/2/24
    From: finland, the l...
    First, understand that this will only work for m68k executables. See the InternalLoadSeg autodoc. You need to provide a function array.

    First pointer is to a function to read data from the filehandle. It is given arguments similar to dos.library/Read(). Next are the allocation and free functions. These are the functions you need to hack. Basically you need to make your own functions that work on the single allocated memory area. You could use Allocate() and Deallocate() on your custom MemHeader for instance.

    Under MorphOS you likely want to use struct EmulLibEntry gates to pass the control to PPC native functions.

    The call itself will appears as:
    Code:

    LONG stackdummy;
    BPTR seglist;
    seglist = InternalLoadSeg(fh, NULL, farray, &stackdummy);


    Note that at InternalUnLoadSeg you must pass a pointer to the same free function!

    I don't have any C example code at hand right now, but if m68k assembly will do, check BlizKick source code.

    [ Edited by Piru on 2011/1/25 11:08 ]
  • »25.01.11 - 09:04
    Profile