#pragma once

#include "pxl8_types.h"

#define PXL8_SAVE_MAX_SLOTS 10
#define PXL8_SAVE_HOTRELOAD_SLOT 255
#define PXL8_SAVE_MAX_PATH 512

typedef struct pxl8_save pxl8_save;

#ifdef __cplusplus
extern "C" {
#endif

pxl8_save* pxl8_save_create(const char* game_name, u32 magic, u32 version);
void pxl8_save_destroy(pxl8_save* save);

pxl8_result pxl8_save_delete(pxl8_save* save, u8 slot);
bool pxl8_save_exists(pxl8_save* save, u8 slot);
void pxl8_save_free(u8* data);
const char* pxl8_save_get_directory(pxl8_save* save);
pxl8_result pxl8_save_read(pxl8_save* save, u8 slot, u8** data_out, u32* size_out);
pxl8_result pxl8_save_write(pxl8_save* save, u8 slot, const u8* data, u32 size);

#ifdef __cplusplus
}
#endif
