Merge pull request #48 from Cuyler36/Famicom

Implement some Famicom structs and definitions
This commit is contained in:
Cuyler36
2023-05-31 05:31:58 -04:00
committed by GitHub
5 changed files with 141 additions and 1 deletions
+61 -1
View File
@@ -2,13 +2,73 @@
#define FAMICOM_H
#include "types.h"
#include "Famicom/ks_nes.h"
#ifdef __cplusplus
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;
/* sizeof (FamicomCommon) == 0xB8 */
typedef struct famicom_common_s {
/* 0x00 */ ksNesCommonWorkObj* wp;
/* 0x04 */ ksNesStateObj* sp;
/* 0x08 */ u8* nesromp;
/* 0x0C */ u8* chrramp;
/* 0x10 */ u8* bbramp;
/* 0x14 */ u8* noise_bufp;
/* 0x18 */ u8* chr_to_i8_bufp;
/* 0x1C */ u8* result_bufp;
/* 0x20 */ u8* highscore_flagsp;
/* 0x24 */ u8* nesinfo_tagsp;
/* 0x28 */ int _28;
/* 0x2C */ u8 player_no;
/* 0x2D */ u8 _2d;
/* 0x2E */ u8 _2e;
/* 0x2F */ u8 mura_save_name[33];
/* 0x50 */ u8 famicom_save_name[33];
/* 0x74 */ FamicomSaveDataHeader* save_data_header;
/* 0x78 */ int _78;
/* 0x7C */ size_t save_data_header_size;
/* 0x80 */ size_t _80;
/* 0x84 */ int _84;
/* 0x88 */ u8* _88;
/* 0x8C */ u16 _8C;
/* 0x8E */ MemcardGameHeader_t memcard_game_header;
/* 0xB0 */ u8* memcard_save_comment;
/* 0xB4 */ int _b4;
} 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
+9
View File
@@ -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
+37
View File
@@ -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
+17
View File
@@ -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
+17
View File
@@ -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