gbfs.inc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. (*
  2. $Id: gbfs.inc 25 2007-12-10 21:06:46Z p4p3r0 $
  3. ------------------------------------------------------------------------------
  4. Copyright
  5. 2002-2004 Damian Yerrick
  6. Additional code Dave Murphy
  7. This software is provided 'as-is', without any express or implied
  8. warranty. In no event will the authors be held liable for any
  9. damages arising from the use of this software.
  10. Permission is granted to anyone to use this software for any
  11. purpose, including commercial applications, and to alter it and
  12. redistribute it freely, subject to the following restrictions:
  13. 1. The origin of this software must not be misrepresented; you
  14. must not claim that you wrote the original software. If you use
  15. this software in a product, an acknowledgment in the product
  16. documentation would be appreciated but is not required.
  17. 2. Altered source versions must be plainly marked as such, and
  18. must not be misrepresented as being the original software.
  19. 3. This notice may not be removed or altered from any source
  20. distribution.
  21. ------------------------------------------------------------------------------
  22. Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
  23. (http://www.freepascal.org)
  24. Copyright (C) 2006 Francesco Lombardi
  25. Check http://sourceforge.net/projects/libndsfpc for updates
  26. ------------------------------------------------------------------------------
  27. $Log$
  28. *)
  29. {$ifdef NDS_INTERFACE}
  30. (* to make a 300 KB space called samples do GBFS_SPACE(samples, 300) *)
  31. {$define GBFS_SPACE(filename, kbytes) := filename: array [(kbytes)*1024 - 1] of AnsiChar = 'PinEightGBFSSpace-' + filename + '-' + kbytes}
  32. type
  33. GBFS_FILE = record
  34. magic: array [0..15] of AnsiChar; // "PinEightGBFS\r\n\032\n"
  35. total_len: cuint32; // total length of archive
  36. dir_off: cuint16; // offset in bytes to directory
  37. dir_nmemb: cuint16; // number of files
  38. reserved: array [0..7] of AnsiChar; // for future use
  39. end;
  40. PGBFS_FILE = ^GBFS_FILE;
  41. GBFS_ENTRY = record
  42. name: array [0..23] of AnsiChar; // filename, nul-padded
  43. len: cuint32; // length of object in bytes
  44. data_offset: cuint32; // in bytes from beginning of file
  45. end;
  46. PGBFS_ENTRY = ^GBFS_ENTRY;
  47. procedure gbfs_search_range(gbfs_1st_limit: cuint32; gbfs_2nd_start: cuint32;
  48. gbfs_2nd_limit: cuint32; gbfs_stride: cuint32); cdecl; external;
  49. function find_first_gbfs_file(const start: pointer): PGBFS_FILE; cdecl; external;
  50. function skip_gbfs_file(const _file: PGBFS_FILE): pointer; cdecl; external;
  51. function gbfs_get_obj(const _file: PGBFS_FILE; const name: PAnsiChar; len: pcuint32): pointer; cdecl; external;
  52. function gbfs_get_nth_obj(const _file: PGBFS_FILE; n: cint {was size_t}; name: PAnsiChar; len: pcuint32): pointer; cdecl; external;
  53. function gbfs_copy_obj(dst: pointer; const _file: PGBFS_FILE; const name: PAnsiChar): pointer; cdecl; external;
  54. function gbfs_count_objs(const _file: PGBFS_FILE): cint {was size_t}; cdecl; external;
  55. {$endif NDS_INTERFACE}