diff --git a/include/Famicom/famicom.h b/include/Famicom/famicom.h index c0795e2a..433c4a68 100644 --- a/include/Famicom/famicom.h +++ b/include/Famicom/famicom.h @@ -7,8 +7,41 @@ extern "C" { #endif -typedef u8 (*FAMICOM_GETSAVECHAN_PROC)(int* player_no, int* slot_card_result); +typedef void* (*MALLOC_ALIGN_FUNC)(size_t size, u32 align); +typedef void (*MALLOC_FREE_FUNC)(void* ptr); +typedef size_t (*MALLOC_GETMEMBLOCKSIZE_FUNC)(void* ptr); +typedef size_t (*MALLOC_GETTOTALFREESIZE_FUNC)(); + +typedef struct malloc_s { + MALLOC_ALIGN_FUNC malloc_align; + MALLOC_FREE_FUNC free; + MALLOC_GETMEMBLOCKSIZE_FUNC getmemblocksize; + MALLOC_GETTOTALFREESIZE_FUNC gettotalfreesize; +} Famicom_MallocInfo; +typedef struct save_data_header_s { + u8 _temp[0x19C0]; +} FamicomSaveDataHeader; + +typedef struct memcard_game_header_s { + u8 _00; + u8 _01; + u8 mori_name[16]; + u16 nesrom_size; + u16 nestags_size; + u16 icon_format; + u16 icon_flags; + u16 banner_size; + u8 flags0; + u8 flags1; + u16 pad; +} MemcardGameHeader_t; + +typedef struct famicom_common_s { + +} FamicomCommon; + +typedef u8 (*FAMICOM_GETSAVECHAN_PROC)(int* player_no, int* slot_card_result); extern void famicom_setCallback_getSaveChan(FAMICOM_GETSAVECHAN_PROC getSaveChan_proc); #ifdef __cplusplus diff --git a/include/Famicom/ks_nes.h b/include/Famicom/ks_nes.h new file mode 100644 index 00000000..2bc8f482 --- /dev/null +++ b/include/Famicom/ks_nes.h @@ -0,0 +1,9 @@ +#ifndef KS_NES_H +#define KS_NES_H + +#include "types.h" +#include "Famicom/ks_nes_common.h" +#include "Famicom/ks_nes_core.h" +#include "Famicom/ks_nes_draw.h" + +#endif diff --git a/include/Famicom/ks_nes_common.h b/include/Famicom/ks_nes_common.h new file mode 100644 index 00000000..daa108d8 --- /dev/null +++ b/include/Famicom/ks_nes_common.h @@ -0,0 +1,37 @@ +#ifndef KS_NES_COMMON_H +#define KS_NES_COMMON_H + +#include "types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define CHR_TO_I8_BUF_SIZE 0x100000 +#define KS_NES_NESFILE_HEADER_SIZE 0x10 +#define KS_NES_PRGROM_SIZE 0x8000 // not certain, generally 32kb (0x8000) +#define KS_NES_CHRROM_SIZE 0x4000 // not certain, usually only 8kb (0x2000) + +#define KS_NES_CHRRAM_SIZE 0x2000 // 8kb +#define KS_NES_BBRAM_SIZE 0x8000 // 32kb, battery backed-up ram +#define KS_NES_NOISE_DATA_SIZE 0x7F000 +#define KS_NES_DRAW_RESULT_SIZE 0x1C800 + +#define KS_NES_SAVE_DATA_HEADER_SIZE + +#define KS_NES_BYTES_PER_KB (1024) +#define KS_NES_TO_KB(b) ((f32)b / (1.0f / (f32)KS_NES_BYTES_PER_KB)) + +typedef struct ks_nes_common_work_obj_s { + u8 _temp[0x8F78]; +} ksNesCommonWorkObj; + +typedef struct ks_nes_state_obj_s { + u8 _temp[0x1A78]; +} ksNesStateObj; + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/Famicom/ks_nes_core.h b/include/Famicom/ks_nes_core.h new file mode 100644 index 00000000..3f6c0899 --- /dev/null +++ b/include/Famicom/ks_nes_core.h @@ -0,0 +1,17 @@ +#ifndef KS_NES_CORE_H +#define KS_NES_CORE_H + +#include "types.h" +#include "Famicom/ks_nes_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/include/Famicom/ks_nes_draw.h b/include/Famicom/ks_nes_draw.h new file mode 100644 index 00000000..79c27e85 --- /dev/null +++ b/include/Famicom/ks_nes_draw.h @@ -0,0 +1,17 @@ +#ifndef KS_NES_DRAW_H +#define KS_NES_DRAW_H + +#include "types.h" +#include "Famicom/ks_nes_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + + + +#ifdef __cplusplus +} +#endif + +#endif