home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / Cruncher / XFD111.LHA / xfd / include / libraries / xfdmaster.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-04  |  14.3 KB  |  370 lines

  1. #ifndef LIBRARIES_XFDMASTER_H
  2. #define LIBRARIES_XFDMASTER_H
  3.  
  4. /*
  5. **    $VER: xfdmaster.h 36.1 (24.9.95)
  6. **
  7. **    Copyright © 1994,95 by Georg Hörmann.
  8. **    All Rights Reserved.
  9. */
  10.  
  11. #ifndef EXEC_LIBRARIES_H
  12. #include <exec/libraries.h>
  13. #endif
  14.  
  15. /*********************
  16. *                    *
  17. *    Library Base    *
  18. *                    *
  19. *********************/
  20.  
  21. struct xfdMasterBase {
  22.     struct Library LibNode;
  23.     ULONG    xfdm_SegList;        /* PRIVATE! */
  24.     APTR    xfdm_DosBase;           /* May be used for I/O etc. */
  25.     APTR    xfdm_FirstSlave;        /* List of available slaves */
  26.     APTR    xfdm_FirstForeman;    /* PRIVATE! */
  27.     ULONG    xfdm_MinBufferSize;    /* (V36) Min. BufSize for xfdRecogBuffer() */
  28.     ULONG    xfdm_MinLinkerSize;    /* (V36) Min. BufSize for xfdRecogLinker() */
  29. };
  30.  
  31. #define XFDM_VERSION    36        /* for OpenLibrary() */
  32. #define XFDM_NAME    "xfdmaster.library"
  33.  
  34. /***************************
  35. *                          *
  36. *    Object Types (V36)    *
  37. *                          *
  38. ***************************/
  39.  
  40. #define XFDOBJ_BUFFERINFO    1    /* xfdBufferInfo structure */
  41. #define XFDOBJ_SEGMENTINFO    2    /* xfdSegmentInfo structure */
  42. #define XFDOBJ_LINKERINFO    3    /* xfdLinkerInfo structure */
  43. #define XFDOBJ_MAX        3    /* PRIVATE! */
  44.  
  45. /********************
  46. *                   *
  47. *    Buffer Info    *
  48. *                   *
  49. ********************/
  50.  
  51. struct xfdBufferInfo {
  52.     APTR    xfdbi_SourceBuffer;    /* Pointer to source buffer */
  53.     ULONG    xfdbi_SourceBufLen;    /* Length of source buffer */
  54.     APTR    xfdbi_Slave;        /* PRIVATE! */
  55.     STRPTR    xfdbi_PackerName;    /* Name of recognized packer */
  56.     UWORD    xfdbi_PackerFlags;    /* Flags for recognized packer */
  57.     UWORD    xfdbi_Error;        /* Error return code */
  58.     APTR    xfdbi_TargetBuffer;    /* Pointer to target buffer */
  59.     ULONG    xfdbi_TargetBufMemType;    /* Memtype of target buffer */
  60.     ULONG    xfdbi_TargetBufLen;    /* Full length of buffer */
  61.     ULONG    xfdbi_TargetBufSaveLen;    /* Used length of buffer */
  62.     ULONG    xfdbi_DecrAddress;    /* Address to load decrunched file */
  63.     ULONG    xfdbi_JmpAddress;    /* Address to jump in file */
  64.     APTR    xfdbi_Special;        /* Special decrunch info (eg. password) */
  65. };
  66.  
  67. #define xfdbi_MaxSpecialLen xfdbi_Error    /* Max. length of special info */
  68.  
  69. /*********************
  70. *                    *
  71. *    Segment Info    *
  72. *                    *
  73. *********************/
  74.  
  75. struct xfdSegmentInfo {
  76.     ULONG    xfdsi_SegList;        /* BPTR to segment list */
  77.     APTR    xfdsi_Slave;        /* PRIVATE! */
  78.     STRPTR    xfdsi_PackerName;    /* Name of recognized packer */
  79.     UWORD    xfdsi_PackerFlags;    /* Flags for recognized packer */
  80.     UWORD    xfdsi_Error;        /* Error return code */
  81.     APTR    xfdsi_Special;        /* Special decrunch info (eg. password) */
  82.     UWORD    xfdsi_RelMode;        /* (V34) Relocation mode */
  83.     UWORD    xfdsi_Reserved0;    /* (V34) Reserved */
  84. };
  85.  
  86. #define xfdsi_MaxSpecialLen xfdsi_Error    /* Max. length of special info */
  87.  
  88. /**************************
  89. *                         *
  90. *    Linker Info (V36)    *
  91. *                         *
  92. **************************/
  93.  
  94. struct xfdLinkerInfo {
  95.     APTR    xfdli_Buffer;        /* Pointer to buffer */
  96.     ULONG    xfdli_BufLen;        /* Length of buffer */
  97.     STRPTR    xfdli_LinkerName;    /* Name of recognized linker */
  98.     APTR    xfdli_Unlink;        /* PRIVATE! */
  99.     UWORD    xfdli_Reserved;        /* Set to NULL */
  100.     UWORD    xfdli_Error;        /* Error return code */
  101.     ULONG    xfdli_Hunk1;        /* PRIVATE! */
  102.     ULONG    xfdli_Hunk2;        /* PRIVATE! */
  103.     ULONG    xfdli_Amount1;        /* PRIVATE! */
  104.     ULONG    xfdli_Amount2;        /* PRIVATE! */
  105.     APTR    xfdli_Save1;        /* Pointer to first unlinked file */
  106.     APTR    xfdli_Save2;        /* Pointer to second unlinked file */
  107.     ULONG    xfdli_SaveLen1;        /* Length of first unlinked file */
  108.     ULONG    xfdli_SaveLen2;        /* Length of second unlinked file */
  109. };
  110.  
  111. /********************
  112. *                   *
  113. *    Error Codes    *
  114. *                   *
  115. ********************/
  116.  
  117. #define XFDERR_OK        0x0000    /* No errors */
  118.  
  119. #define XFDERR_NOMEMORY        0x0001    /* Error allocating memory */
  120. #define XFDERR_NOSLAVE        0x0002    /* No slave entry in info structure */
  121. #define XFDERR_NOTSUPPORTED    0x0003    /* Slave doesn't support called function */
  122. #define XFDERR_UNKNOWN        0x0004    /* Unknown file */
  123. #define XFDERR_NOSOURCE        0x0005    /* No sourcebuffer/seglist specified */
  124. #define XFDERR_WRONGPASSWORD    0x0006    /* Wrong password for decrunching */
  125. #define XFDERR_BADHUNK        0x0007    /* Bad hunk structure */
  126. #define XFDERR_CORRUPTEDDATA    0x0008    /* Crunched data is corrupted */
  127. #define XFDERR_MISSINGRESOURCE    0x0009    /* (V34) Missing resource (eg. library) */
  128. #define XFDERR_WRONGKEY        0x000a    /* (V35) wrong 16/32 bit key */
  129.  
  130. #define XFDERR_UNDEFINEDHUNK    0x1000    /* (V34) Undefined hunk type */
  131. #define XFDERR_NOHUNKHEADER    0x1001    /* (V34) File is not executable */
  132. #define XFDERR_BADEXTTYPE    0x1002    /* (V34) Bad hunk_ext type */
  133. #define XFDERR_BUFFERTRUNCATED    0x1003    /* (V34) Unexpected end of file */
  134. #define XFDERR_WRONGHUNKAMOUNT    0x1004    /* (V34) Wrong amount of hunks */
  135. #define XFDERR_NOOVERLAYS    0x1005    /* (V36) Overlays not allowed */
  136.  
  137. #define XFDERR_UNSUPPORTEDHUNK    0x2000    /* (V34) Hunk type not supported */
  138. #define XFDERR_BADRELMODE    0x2001    /* (V34) Unknown XFDREL_#? mode */
  139.  
  140. /*******************************
  141. *                              *
  142. *    Relocation Modes (V34)    *
  143. *                              *
  144. *******************************/
  145.  
  146. #define XFDREL_DEFAULT        0x0000    /* Use memory types given by hunk_header */
  147. #define XFDREL_FORCECHIP    0x0001    /* Force all hunks to chip ram */
  148. #define XFDREL_FORCEFAST    0x0002    /* Force all hunks to fast ram */
  149.  
  150. /*************************************
  151. *                                    *
  152. *    Values for xfd??_PackerFlags    *
  153. *                                    *
  154. *************************************/
  155.  
  156. /* Bit numbers */
  157. #define XFDPFB_RELOC    0    /* Relocatible file packer */
  158. #define XFDPFB_ADDR    1    /* Absolute address file packer */
  159. #define XFDPFB_DATA    2    /* Data file packer */
  160.  
  161. #define XFDPFB_PASSWORD    4    /* Packer requires password */
  162. #define XFDPFB_RELMODE    5    /* (V34) Decruncher supports xfdsi_RelMode */
  163. #define XFDPFB_KEY16    6    /* (V35) Packer requires 16 bit key */
  164. #define XFDPFB_KEY32    7    /* (V35) Packer requires 32 bit key */
  165.  
  166. /* Bit masks */
  167. #define XFDPFF_RELOC    (1<<XFDPFB_RELOC)
  168. #define XFDPFF_ADDR    (1<<XFDPFB_ADDR)
  169. #define XFDPFF_DATA    (1<<XFDPFB_DATA)
  170.  
  171. #define XFDPFF_PASSWORD    (1<<XFDPFB_PASSWORD)
  172. #define XFDPFF_RELMODE    (1<<XFDPFB_RELMODE)
  173. #define XFDPFF_KEY16    (1<<XFDPFB_KEY16)
  174. #define XFDPFF_KEY32    (1<<XFDPFB_KEY32)
  175.  
  176. /****************************************************
  177. *                                                   *
  178. *    Flags for xfdTestHunkStructureFlags() (V36)    *
  179. *                                                   *
  180. ****************************************************/
  181.  
  182. /* Bit numbers */
  183. #define XFDTHB_NOOVERLAYS    0    /* Abort on hunk_overlay */
  184.  
  185. /* Bit masks */
  186. #define XFDTHF_NOOVERLAYS    (1<<XFDTHB_NOOVERLAYS)
  187.  
  188. /****************************************
  189. *                                       *
  190. *    Flags for xfdStripHunks() (V36)    *
  191. *                                       *
  192. ****************************************/
  193.  
  194. /* Bit numbers */
  195. #define XFDSHB_NAME    0    /* Strip hunk_name */
  196. #define XFDSHB_SYMBOL    1    /* Strip hunk_symbol */
  197. #define XFDSHB_DEBUG    2    /* Strip hunk_debug */
  198.  
  199. /* Bit masks */
  200. #define XFDSHF_NAME    (1<<XFDSHB_NAME)
  201. #define XFDSHF_SYMBOL    (1<<XFDSHB_SYMBOL)
  202. #define XFDSHF_DEBUG    (1<<XFDSHB_DEBUG)
  203.  
  204. /****************
  205. *               *
  206. *    Foreman    *
  207. *               *
  208. ****************/
  209.  
  210. struct xfdForeMan {
  211.     ULONG    xfdf_Security;        /* moveq #-1,d0 ; rts */
  212.     ULONG    xfdf_ID;        /* Set to XFDF_ID */
  213.     UWORD    xfdf_Version;        /* Set to XFDF_VERSION */
  214.     UWORD    xfdf_Reserved;        /* Not used by now, set to NULL */
  215.     ULONG    xfdf_Next;        /* PRIVATE! */
  216.     ULONG    xfdf_SegList;        /* PRIVATE! */
  217.     APTR    xfdf_FirstSlave;    /* First slave (see below) */
  218. };
  219.  
  220. #define XFDF_ID        (('X'<<24)|('F'<<16)|('D'<<8)|('F'))
  221. #define XFDF_VERSION    1
  222.  
  223. /**************
  224. *             *
  225. *    Slave    *
  226. *             *
  227. **************/
  228.  
  229. struct xfdSlave {
  230.     APTR    xfds_Next;        /* Next slave (or NULL) */
  231.     UWORD    xfds_Version;        /* Set to XFDS_VERSION */
  232.     UWORD    xfds_MasterVersion;    /* Minimum XFDM_VERSION required */
  233.     STRPTR    xfds_PackerName;    /* Name of packer ('\0' terminated) */
  234.     UWORD    xfds_PackerFlags;    /* Flags for packer */
  235.     UWORD    xfds_MaxSpecialLen;    /* Max. length of special info (eg. password) */
  236.     APTR    xfds_RecogBuffer;    /* APTR to buffer recognition code (or NULL) */
  237.     APTR    xfds_DecrunchBuffer;    /* APTR to buffer decrunch code (or NULL) */
  238.     APTR    xfds_RecogSegment;    /* APTR to segment recognition code (or NULL) */
  239.     APTR    xfds_DecrunchSegment;    /* APTR to segment decrunch code (or NULL) */
  240.     UWORD    xfds_SlaveID;        /* (V36) Slave ID (only internal slaves) */
  241.     UWORD    xfds_ReplaceID;        /* (V36) ID of slave to be replaced */
  242.     ULONG    xfds_MinBufferSize;    /* (V36) Min. BufSize for RecogBufferXYZ() */
  243. };
  244.  
  245. #define XFDS_VERSION    2
  246.  
  247. /*********************************
  248. *                                *
  249. *    Internal Slave IDs (V36)    *
  250. *                                *
  251. *********************************/
  252.  
  253. #define XFDID_BASE    0x8000
  254.  
  255. #define XFDID_PowerPacker23Normal    (XFDID_BASE+0x0001)
  256. #define XFDID_PowerPacker23Master    (XFDID_BASE+0x0002)
  257. #define XFDID_PowerPacker30Normal    (XFDID_BASE+0x0003)
  258. #define XFDID_PowerPacker30Master    (XFDID_BASE+0x0004)
  259. #define XFDID_PowerPacker30NormEnc    (XFDID_BASE+0x0005)
  260. #define XFDID_PowerPacker30MastEnc    (XFDID_BASE+0x0006)
  261. #define XFDID_PowerPacker30NormOvl    (XFDID_BASE+0x0007)
  262. #define XFDID_PowerPacker30MastOvl    (XFDID_BASE+0x0008)
  263. #define XFDID_PowerPacker40        (XFDID_BASE+0x0009)
  264. #define XFDID_PowerPacker40Lib        (XFDID_BASE+0x000a)
  265. #define XFDID_PowerPacker40Enc        (XFDID_BASE+0x000b)
  266. #define XFDID_PowerPacker40LibEnc    (XFDID_BASE+0x000c)
  267. #define XFDID_PowerPacker40Ovl        (XFDID_BASE+0x000d)
  268. #define XFDID_PowerPacker40LibOvl    (XFDID_BASE+0x000e)
  269. #define XFDID_PowerPackerData        (XFDID_BASE+0x000f)
  270. #define XFDID_PowerPackerDataEnc    (XFDID_BASE+0x0010)
  271. #define XFDID_ByteKiller13        (XFDID_BASE+0x0011)
  272. #define XFDID_ByteKiller20        (XFDID_BASE+0x0012)
  273. #define XFDID_ByteKiller30        (XFDID_BASE+0x0013)
  274. #define XFDID_ByteKillerPro10        (XFDID_BASE+0x0014)
  275. #define XFDID_ByteKillerPro10Pro    (XFDID_BASE+0x0015)
  276. #define XFDID_DragPack10        (XFDID_BASE+0x0016)
  277. #define XFDID_TNMCruncher11        (XFDID_BASE+0x0017)
  278. #define XFDID_HQCCruncher20        (XFDID_BASE+0x0018)
  279. #define XFDID_RSICruncher14        (XFDID_BASE+0x0019)
  280. #define XFDID_ANCCruncher        (XFDID_BASE+0x001a)
  281. #define XFDID_ReloKit10            (XFDID_BASE+0x001b)
  282. #define XFDID_HighPressureCruncher    (XFDID_BASE+0x001c)
  283. #define XFDID_STPackedSong        (XFDID_BASE+0x001d)
  284. #define XFDID_TSKCruncher        (XFDID_BASE+0x001e)
  285. #define XFDID_LightPack15        (XFDID_BASE+0x001f)
  286. #define XFDID_CrunchMaster10        (XFDID_BASE+0x0020)
  287. #define XFDID_HQCCompressor100        (XFDID_BASE+0x0021)
  288. #define XFDID_FlashSpeed10        (XFDID_BASE+0x0022)
  289. #define XFDID_CrunchManiaData        (XFDID_BASE+0x0023)
  290. #define XFDID_CrunchManiaDataEnc    (XFDID_BASE+0x0024)
  291. #define XFDID_CrunchManiaLib        (XFDID_BASE+0x0025)
  292. #define XFDID_CrunchManiaNormal        (XFDID_BASE+0x0026)
  293. #define XFDID_CrunchManiaSimple        (XFDID_BASE+0x0027)
  294. #define XFDID_CrunchManiaAddr        (XFDID_BASE+0x0028)
  295. #define XFDID_DefJamCruncher32        (XFDID_BASE+0x0029)
  296. #define XFDID_DefJamCruncher32Pro    (XFDID_BASE+0x002a)
  297. #define XFDID_TetraPack102        (XFDID_BASE+0x002b)
  298. #define XFDID_TetraPack11        (XFDID_BASE+0x002c)
  299. #define XFDID_TetraPack21        (XFDID_BASE+0x002d)
  300. #define XFDID_TetraPack21Pro        (XFDID_BASE+0x002e)
  301. #define XFDID_TetraPack22        (XFDID_BASE+0x002f)
  302. #define XFDID_TetraPack22Pro        (XFDID_BASE+0x0030)
  303. #define XFDID_DoubleAction10        (XFDID_BASE+0x0031)
  304. #define XFDID_DragPack252Data        (XFDID_BASE+0x0032)
  305. #define XFDID_DragPack252        (XFDID_BASE+0x0033)
  306. #define XFDID_FCG10            (XFDID_BASE+0x0034)
  307. #define XFDID_Freeway07            (XFDID_BASE+0x0035)
  308. #define XFDID_IAMPacker10ATM5Data    (XFDID_BASE+0x0036)
  309. #define XFDID_IAMPacker10ATM5        (XFDID_BASE+0x0037)
  310. #define XFDID_IAMPacker10ICEData    (XFDID_BASE+0x0038)
  311. #define XFDID_IAMPacker10ICE        (XFDID_BASE+0x0039)
  312. #define XFDID_Imploder            (XFDID_BASE+0x003a)
  313. #define XFDID_ImploderLib        (XFDID_BASE+0x003b)
  314. #define XFDID_ImploderOvl        (XFDID_BASE+0x003c)
  315. #define XFDID_FileImploder        (XFDID_BASE+0x003d)
  316. #define XFDID_Team17Cruncher        (XFDID_BASE+0x003e)
  317. #define XFDID_MasterCruncher30Addr    (XFDID_BASE+0x003f)
  318. #define XFDID_MasterCruncher30        (XFDID_BASE+0x0040)
  319. #define XFDID_MaxPacker12        (XFDID_BASE+0x0041)
  320. #define XFDID_PackIt10Data        (XFDID_BASE+0x0042)
  321. #define XFDID_PackIt10            (XFDID_BASE+0x0043)
  322. #define XFDID_PMCNormal            (XFDID_BASE+0x0044)
  323. #define XFDID_PMCSample            (XFDID_BASE+0x0045)
  324. #define XFDID_XPKPacked            (XFDID_BASE+0x0046)
  325. #define XFDID_XPKCrypted        (XFDID_BASE+0x0047)
  326. #define XFDID_TimeCruncher17        (XFDID_BASE+0x0048)
  327. #define XFDID_TFACruncher154        (XFDID_BASE+0x0049)
  328. #define XFDID_TurtleSmasher13        (XFDID_BASE+0x004a)
  329. #define XFDID_MegaCruncher10        (XFDID_BASE+0x004b)
  330. #define XFDID_MegaCruncher12        (XFDID_BASE+0x004c)
  331. #define XFDID_ProPack            (XFDID_BASE+0x004d)
  332. #define XFDID_ProPackData        (XFDID_BASE+0x004e)
  333. #define XFDID_ProPackDataKey        (XFDID_BASE+0x004f)
  334. #define XFDID_STCruncher10        (XFDID_BASE+0x0050)
  335. #define XFDID_STCruncher10Data        (XFDID_BASE+0x0051)
  336. #define XFDID_SpikeCruncher        (XFDID_BASE+0x0052)
  337. #define XFDID_SyncroPacker46        (XFDID_BASE+0x0053)
  338. #define XFDID_SyncroPacker46Pro        (XFDID_BASE+0x0054)
  339. #define XFDID_TitanicsCruncher11    (XFDID_BASE+0x0055)
  340. #define XFDID_TitanicsCruncher12    (XFDID_BASE+0x0056)
  341. #define XFDID_TryItCruncher101        (XFDID_BASE+0x0057)
  342. #define XFDID_TurboSqueezer61        (XFDID_BASE+0x0058)
  343. #define XFDID_TurboSqueezer80        (XFDID_BASE+0x0059)
  344. #define XFDID_TurtleSmasher200        (XFDID_BASE+0x005a)
  345. #define XFDID_TurtleSmasher200Data    (XFDID_BASE+0x005b)
  346. #define XFDID_StoneCracker270        (XFDID_BASE+0x005c)
  347. #define XFDID_StoneCracker270Pro    (XFDID_BASE+0x005d)
  348. #define XFDID_StoneCracker292        (XFDID_BASE+0x005e)
  349. #define XFDID_StoneCracker299        (XFDID_BASE+0x005f)
  350. #define XFDID_StoneCracker299d        (XFDID_BASE+0x0060)
  351. #define XFDID_StoneCracker300        (XFDID_BASE+0x0061)
  352. #define XFDID_StoneCracker300Data    (XFDID_BASE+0x0062)
  353. #define XFDID_StoneCracker310        (XFDID_BASE+0x0063)
  354. #define XFDID_StoneCracker310Data    (XFDID_BASE+0x0064)
  355. #define XFDID_StoneCracker311        (XFDID_BASE+0x0065)
  356. #define XFDID_StoneCracker400        (XFDID_BASE+0x0066)
  357. #define XFDID_StoneCracker400Data    (XFDID_BASE+0x0067)
  358. #define XFDID_StoneCracker401        (XFDID_BASE+0x0068)
  359. #define XFDID_StoneCracker401Data    (XFDID_BASE+0x0069)
  360. #define XFDID_StoneCracker401Addr    (XFDID_BASE+0x006a)
  361. #define XFDID_StoneCracker401BetaAddr    (XFDID_BASE+0x006b)
  362. #define XFDID_StoneCracker403Data    (XFDID_BASE+0x006c)
  363. #define XFDID_StoneCracker404        (XFDID_BASE+0x006d)
  364. #define XFDID_StoneCracker404Data    (XFDID_BASE+0x006e)
  365. #define XFDID_StoneCracker404Addr    (XFDID_BASE+0x006f)
  366. #define XFDID_ChryseisCruncher09    (XFDID_BASE+0x0070)
  367. #define XFDID_QuickPowerPacker10    (XFDID_BASE+0x0071)
  368.  
  369. #endif /* LIBRARIES_XFDMASTER_H */
  370.