source: golgotha/src/i4/loaders/dir_load.hh @ 608

Last change on this file since 608 was 80, checked in by Sam Hocevar, 15 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.5 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef I4_DIR_LOAD_HH
10#define I4_DIR_LOAD_HH
11
12
13
14#include "file/file.hh"
15#include "memory/array.hh"
16#include "error/error.hh"
17
18struct i4_loader_section_type
19{
20  w32 section_id;
21  w32 section_offset;
22  w32 section_size;
23  i4_loader_section_type(w32 section_id, w32 section_offset)
24    : section_offset(section_offset), section_id(section_id) {}
25};
26
27
28class i4_loader_class : public i4_file_class
29{
30protected:
31  i4_file_class *in;
32  i4_array<i4_loader_section_type> sections;
33
34  i4_bool close_on_delete, _error;
35  sw32 last;
36  int seek_to_before_using;
37  int find_section(w32 section_id);
38public:
39
40  i4_bool error() { return _error; }
41
42  i4_loader_class(i4_file_class *in, i4_bool close_on_delete=i4_T);
43
44  i4_bool goto_section(w32 section_id);
45  i4_bool goto_section(char *section_name);       // calls above with checksum of name
46 
47  i4_bool get_section_info(char *section_name, w32 &offset, w32 &size);
48
49  // if version numbers don't match AND seek_on_fail is i4_T, file pointer
50  // is advanced to the spot where
51  // end_version was called when saving and i4_F is returned
52  i4_bool check_version(w16 version);
53  void end_version(I4_LF_ARGS);          // verifies you read the proper amount of data
54
55  //check_version replaced with get_version
56  void get_version(w16 &version,w16 &data_size);
57 
58 
59  virtual w32 read (void *buffer, w32 size);
60  virtual w32 write(const void *buffer, w32 size);
61
62  virtual w32 seek (w32 offset);
63  virtual w32 size ();
64  virtual w32 tell ();
65
66  virtual ~i4_loader_class();
67};
68
69// returns NULL if file is corrupted
70i4_loader_class *i4_open_save_file(i4_file_class *in,
71                                   i4_bool close_on_delete_or_fail=i4_T);
72
73// this function will insert data into a demo_file
74i4_bool i4_insert_sections(i4_file_class *in, i4_file_class *out,
75                           int total_sections_to_insert,
76                           i4_file_class **section_data,
77                           char **section_names);
78
79#endif
Note: See TracBrowser for help on using the repository browser.