Esempio n. 1
0
// saves the line to the current file
void Tline::save(Tmap *m,Tcluster *c,Tsector *s)
{
  Tmap_item::save();
  // writes first and second ends
  wrlong( v1 );
  wrlong( v2 );

  // writes all the walls
  wrlong(wallsnum);
  Twall **w;
  int i;
  for (i=0,w=walls;i<wallsnum;NEXTWALL(w),i++)
    (*w)->save(m,c,s,this);
}
Esempio n. 2
0
// saves the cluster to the current file
void Tcluster::save(Tmap *m)
{
  Tmap_item::save();
  wrlong( sectorsnum );
  int i;
  Tsector *s;
  for (i=0,s=sectors;i<sectorsnum;NEXTSECTOR(s),i++)
    s->save(m,this);
}
Esempio n. 3
0
void load_binfile (const char *bin_filename)
{
	s32 reloc, next, pos, code_end, len, i = 0;
	FILE *f;

	if ((f = fopen (bin_filename, "r")) == NULL) {
		fprintf (stderr, "Error opening 68k-binary '%s'\n", bin_filename);
		//SDL_Quit ();
		exit (-2);
	}
	fseek (f, 0, SEEK_END);
	len = ftell (f);
	fseek (f, 0, SEEK_SET);
	assert (len+LOAD_BASE < MEM_SIZE);
	fread (m68kram+LOAD_BASE, 1, len, f);
	fclose (f);
	
	buf_pos = LOAD_BASE + 2;
	code_end = LOAD_BASE + 0x1c + rdlong (buf_pos);
	i=0;
	reloc = get_fixup (0, code_end);
	while (reloc) {
		i++;
		pos = buf_pos;
		/* address to be modified */
		buf_pos = reloc;
		next = rdlong (buf_pos);
		next += LOAD_BASE;
		wrlong (buf_pos, next);
		if (next > code_end) {
			fprintf (stderr, "Reloc 0x%x (0x%x) out of range..\n", next, reloc+LOAD_BASE);
		}
		buf_pos = pos;
		reloc = get_fixup (reloc, code_end);
	}
	fprintf (stderr, "%s: 0x%x bytes (code end 0x%x), %d fixups; loaded at 0x%x.\n", bin_filename, len, code_end, i, LOAD_BASE);
}