/***************************************************************************

	state.c

	Save / Load state

***************************************************************************/

#ifndef STATE_H
#define STATE_H

#ifdef SAVE_STATE

#define state_save_byte(v, n)	{ memcpy(in, v, 1 * n); in += 1 * n; }
#define state_save_word(v, n)	{ memcpy(in, v, 2 * n); in += 2 * n; }
#define state_save_long(v, n)	{ memcpy(in, v, 4 * n); in += 4 * n; }
#define state_save_double(v, n)	{ memcpy(in, v, 8 * n); in += 8 * n; }

#define state_load_byte(v, n)	{ memcpy(v, out, 1 * n); out += 1 * n; }
#define state_load_word(v, n)	{ memcpy(v, out, 2 * n); out += 2 * n; }
#define state_load_long(v, n)	{ memcpy(v, out, 4 * n); out += 4 * n; }
#define state_load_double(v, n)	{ memcpy(v, out, 8 * n); out += 8 * n; }

extern u16 thumbnail_buf[152 * 112 + 0x100];
extern char date_str[16];
extern char time_str[16];
extern char stver_str[16];

void state_init(void);
int state_save(int slot);
int state_load(int slot);
int state_load_screen(int slot);

#if 0
void state_prg_mark_upload(void);
void state_fix_mark_upload(void);
void state_spr_mark_upload(void);
void state_pcm_mark_upload(void);
void state_pal_mark_upload(void);
#endif

void state_fix_mark_loadfile(const char *fname, u32 offset, u32 length);
void state_spr_mark_loadfile(const char *fname, int bank, u32 offset, u32 length);
void state_pcm_mark_loadfile(const char *fname, int bank, u32 offset, u32 length);

#endif

#endif /* STATE_H */
