mirror of
https://github.com/ACreTeam/ac-decomp
synced 2026-05-23 06:34:18 -04:00
Merge pull request #238 from Cuyler36:famicom_cpp
Implement & link famicom.cpp
This commit is contained in:
@@ -434,7 +434,9 @@ JSYSTEM_JGADGET_BASE = [
|
||||
FAMICOM_BASE = CFLAGS + [
|
||||
"-lang=c++",
|
||||
"-sdata 0",
|
||||
"-sdata2 0"
|
||||
"-sdata2 0",
|
||||
"-enum int",
|
||||
"-sym on"
|
||||
] + DOL_DEFINES
|
||||
|
||||
JSYSTEM_CFLAGS = ' '.join(JSYSTEM_BASE + LOCAL_CFLAGS)
|
||||
|
||||
@@ -48,6 +48,11 @@ jaudio_NES/dummyprobe.c:
|
||||
#jaudio_NES/verysimple.c:
|
||||
# .text: [0x80008400, 0x80008480]
|
||||
# .sdata: [0x80217b80, 0x80217b88]
|
||||
Famicom/famicom.cpp:
|
||||
.text: [0x80041614, 0x80046888] # TODO: get ~J2DOrthoGraph's dtor in here somehow? 0x800468fc, also add in JUTGamePad::getPortStatus when JUTGamePad is linked?
|
||||
.rodata: [0x800aa9a8, 0x800aaa30]
|
||||
.data: [0x800d8778, 0x800d99a0]
|
||||
.bss: [0x801ef540, 0x801f6bd8]
|
||||
Famicom/famicom_nesinfo.cpp:
|
||||
.text: [0x800468fc, 0x80047e40]
|
||||
.rodata: [0x800aaa30, 0x800aab60]
|
||||
|
||||
@@ -2634,6 +2634,7 @@ global:
|
||||
0x8009ae84: _restfpr_28
|
||||
0x8009ae88: _restfpr_29
|
||||
0x8009ae98: __save_gpr
|
||||
0x8009ae98: _savegpr_14
|
||||
0x8009ae9c: _savegpr_15
|
||||
0x8009aea0: _savegpr_16
|
||||
0x8009aea4: _savegpr_17
|
||||
@@ -2650,6 +2651,7 @@ global:
|
||||
0x8009aed0: _savegpr_28
|
||||
0x8009aed4: _savegpr_29
|
||||
0x8009aee4: __restore_gpr
|
||||
0x8009aee4: _restgpr_14
|
||||
0x8009aee8: _restgpr_15
|
||||
0x8009aeec: _restgpr_16
|
||||
0x8009aef0: _restgpr_17
|
||||
|
||||
+4
-1
@@ -637,7 +637,10 @@ class CSource(Source):
|
||||
self.cc = c.CC
|
||||
elif path.startswith("src/static/Famicom/"):
|
||||
self.cflags = c.FAMICOM_CLFAGS
|
||||
self.cc = c.CC
|
||||
if "ksNes" in path: # ksNes doesn't have rodata pooling off
|
||||
self.cc = c.CC
|
||||
else:
|
||||
self.cc = c.CC_R
|
||||
elif path.startswith("src/static/GBA2/"):
|
||||
self.cflags = c.DOL_CFLAGS_SDATA0_CFLAGS
|
||||
self.cc = c.CC
|
||||
|
||||
+103
-26
@@ -9,6 +9,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define FAMICOM_SAVE_HEADER_SIZE 0x40
|
||||
#define FAMICOM_INTERNAL_ROM_NUM 19
|
||||
|
||||
#define NESTAG_CMD_SIZE 3
|
||||
@@ -44,8 +45,8 @@ extern "C" {
|
||||
|
||||
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 int (*MALLOC_GETMEMBLOCKSIZE_FUNC)(void* ptr);
|
||||
typedef int (*MALLOC_GETTOTALFREESIZE_FUNC)();
|
||||
|
||||
typedef struct malloc_s {
|
||||
MALLOC_ALIGN_FUNC malloc_align;
|
||||
@@ -54,11 +55,59 @@ typedef struct malloc_s {
|
||||
MALLOC_GETTOTALFREESIZE_FUNC gettotalfreesize;
|
||||
} Famicom_MallocInfo;
|
||||
|
||||
typedef struct save_data_header_s {
|
||||
u8 _temp[0x19C0];
|
||||
enum filer_demo_mode {
|
||||
FILER_DEMO_MODE_NORMAL,
|
||||
FILER_DEMO_MODE_AUTO,
|
||||
|
||||
FILER_DEMO_MODE_NUM
|
||||
};
|
||||
|
||||
#define FAMICOM_SAVE_DATA_NAME_LEN 8
|
||||
|
||||
typedef struct FamicomSaveDataHeader {
|
||||
u8 name[FAMICOM_SAVE_DATA_NAME_LEN];
|
||||
u8 _08;
|
||||
u8 _09;
|
||||
u8 headerSize;
|
||||
u8 checksum;
|
||||
u16 size;
|
||||
u8 no_save;
|
||||
u8 _temp[FAMICOM_SAVE_HEADER_SIZE - 0x000F];
|
||||
} FamicomSaveDataHeader;
|
||||
|
||||
typedef struct memcard_game_header_s {
|
||||
enum {
|
||||
MEMCARD_COMMENT_TYPE_NONE,
|
||||
MEMCARD_COMMENT_TYPE_DEFAULT,
|
||||
MEMCARD_COMMENT_TYPE_COPY_ROM, // converts rom's comment but converts "] ROM" to "] SAVE"
|
||||
MEMCARD_COMMENT_TYPE_COPY_EMBEDDED // uses the embedded and unique 'save' comment
|
||||
};
|
||||
|
||||
enum {
|
||||
MEMCARD_BANNER_TYPE_NONE,
|
||||
MEMCARD_BANNER_TYPE_DEFAULT,
|
||||
MEMCARD_BANNER_TYPE_COPY_ROM, // copies the NES rom save's banner
|
||||
MEMCARD_BANNER_TYPE_COPY_EMBEDDED // uses the embedded and unique 'save' banner
|
||||
};
|
||||
|
||||
enum {
|
||||
MEMCARD_ICON_TYPE_NONE,
|
||||
MEMCARD_ICON_TYPE_DEFAULT,
|
||||
MEMCARD_ICON_TYPE_COPY_ROM, // copies the NES rom save's icon
|
||||
MEMCARD_ICON_TYPE_COPY_EMBEDDED // uses the embedded and unique 'save' icon
|
||||
};
|
||||
|
||||
enum {
|
||||
FAMICOM_RESULT_OK,
|
||||
FAMICOM_RESULT_NOSPACE,
|
||||
FAMICOM_RESULT_NOENTRY,
|
||||
FAMICOM_RESULT_BROKEN,
|
||||
FAMICOM_RESULT_WRONGDEVICE,
|
||||
FAMICOM_RESULT_WRONGENCODING,
|
||||
FAMICOM_RESULT_NOCARD,
|
||||
FAMICOM_RESULT_NOFILE
|
||||
};
|
||||
|
||||
typedef struct MemcardGameHeader_t {
|
||||
u8 _00;
|
||||
u8 _01;
|
||||
u8 mori_name[16];
|
||||
@@ -66,14 +115,24 @@ typedef struct memcard_game_header_s {
|
||||
u16 nestags_size;
|
||||
u16 icon_format;
|
||||
u16 icon_flags;
|
||||
u16 banner_size;
|
||||
u8 flags0;
|
||||
u8 flags1;
|
||||
u16 comment_img_size; /* Size of comment + banner + icon */
|
||||
struct {
|
||||
u8 has_comment_img:1;
|
||||
u8 comment_type:2;
|
||||
u8 banner_type:2;
|
||||
u8 icon_type:2;
|
||||
u8 no_copy_flag:1;
|
||||
} flags0;
|
||||
struct {
|
||||
u8 no_move_flag:1;
|
||||
u8 banner_fmt:2;
|
||||
u8 reserved:5;
|
||||
} flags1;
|
||||
u16 pad;
|
||||
} MemcardGameHeader_t;
|
||||
|
||||
/* sizeof (FamicomCommon) == 0xB8 */
|
||||
typedef struct famicom_common_s {
|
||||
typedef struct FamicomCommon {
|
||||
/* 0x00 */ ksNesCommonWorkObj* wp;
|
||||
/* 0x04 */ ksNesStateObj* sp;
|
||||
/* 0x08 */ u8* nesromp;
|
||||
@@ -85,27 +144,28 @@ typedef struct famicom_common_s {
|
||||
/* 0x20 */ u8* highscore_flagsp;
|
||||
/* 0x24 */ u8* nesinfo_tagsp;
|
||||
/* 0x28 */ int _28;
|
||||
/* 0x2C */ u8 player_no;
|
||||
/* 0x2D */ u8 _2d;
|
||||
/* 0x2E */ u8 _2e;
|
||||
/* 0x2C */ u8 nesrom_memcard; // TRUE: rom is loaded from memcard, FALSE: rom is loaded internally
|
||||
/* 0x2D */ u8 rom_no;
|
||||
/* 0x2E */ s8 save_pl_no;
|
||||
/* 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;
|
||||
/* 0x78 */ u8* internal_save_datap;
|
||||
/* 0x7C */ size_t save_data_total_size;
|
||||
/* 0x80 */ size_t save_data_single_size;
|
||||
/* 0x84 */ int _84;
|
||||
/* 0x88 */ u8* _88;
|
||||
/* 0x8C */ u16 _8C;
|
||||
/* 0x88 */ u8* save_data_name;
|
||||
/* 0x8C */ u8 _8C;
|
||||
/* 0x8D */ u8 low_res_mode;
|
||||
/* 0x8E */ MemcardGameHeader_t memcard_game_header;
|
||||
/* 0xB0 */ u8* memcard_save_comment;
|
||||
/* 0xB4 */ int _b4;
|
||||
/* 0xB4 */ size_t unused_save_data_start_ofs;
|
||||
} FamicomCommon;
|
||||
|
||||
|
||||
extern void* my_malloc_current;
|
||||
extern Famicom_MallocInfo* my_malloc_current;
|
||||
extern u8 save_game_image;
|
||||
extern char** nesrom_filename_ptrs;
|
||||
extern u8** nesrom_filename_ptrs;
|
||||
|
||||
extern u32 nesinfo_tags_size;
|
||||
extern u8* nesinfo_tags_start;
|
||||
@@ -115,16 +175,33 @@ extern u32 nesinfo_data_size;
|
||||
extern u8* nesinfo_data_start;
|
||||
extern u8* nesinfo_data_end;
|
||||
|
||||
extern u8 InputValid[];
|
||||
extern u32 InputData[];
|
||||
extern u32 InputButton[];
|
||||
extern u32 InputTrigger[];
|
||||
extern u32 InputRepeat[];
|
||||
extern u32 InputRepeatCount[];
|
||||
|
||||
extern u8 tcs_bad;
|
||||
extern u8 ics_bad;
|
||||
|
||||
extern FamicomCommon famicomCommon;
|
||||
|
||||
typedef u8 (*FAMICOM_GETSAVECHAN_PROC)(int* player_no, int* slot_card_result);
|
||||
extern void famicom_setCallback_getSaveChan(FAMICOM_GETSAVECHAN_PROC getSaveChan_proc);
|
||||
extern int famicom_mount_archive();
|
||||
typedef s32 (*FAMICOM_GETSAVECHAN_PROC)(int* player_no, s32* slot_card_result);
|
||||
|
||||
extern int famicom_getErrorChan();
|
||||
extern void famicom_setCallback_getSaveChan(FAMICOM_GETSAVECHAN_PROC proc);
|
||||
extern int famicom_mount_archive_end_check();
|
||||
extern int famicom_rom_load_check();
|
||||
extern int famicom_1frame();
|
||||
extern int famicom_init(int, void*, u8);
|
||||
extern void famicom_mount_archive();
|
||||
extern int famicom_init(int rom_idx, Famicom_MallocInfo* malloc_info, int player_no);
|
||||
extern int famicom_cleanup();
|
||||
extern void famicom_1frame();
|
||||
extern int famicom_rom_load_check();
|
||||
extern int famicom_internal_data_load();
|
||||
extern int famicom_internal_data_save();
|
||||
extern int famicom_external_data_save();
|
||||
extern int famicom_external_data_save_check();
|
||||
extern int famicom_get_disksystem_titles(int* n_games, char* title_name_bufp, int namebuf_size);
|
||||
|
||||
extern void nesinfo_tags_set(int rom_no);
|
||||
extern void nesinfo_tag_process1(u8* save_data, int mode, u32* max_ofs_p);
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#ifndef FAMICOMINTERNAL_H
|
||||
#define FAMICOMINTERNAL_H
|
||||
|
||||
#include "types.h"
|
||||
#include "Famicom/famicom.h"
|
||||
#include "Famicom/ks_nes.h"
|
||||
|
||||
#define MURA_GAME_NAME_SIZE 16
|
||||
|
||||
static void* my_malloc(size_t size, u32 align) { return (*my_malloc_current->malloc_align)(size, align); }
|
||||
static void my_free(void* ptr) { (*my_malloc_current->free)(ptr); }
|
||||
static int my_getmemblocksize(void* ptr) { return (*my_malloc_current->getmemblocksize)(ptr); }
|
||||
static int my_gettotalfreesize() { return (*my_malloc_current->gettotalfreesize)(); }
|
||||
|
||||
#endif
|
||||
@@ -7,28 +7,71 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define KS_NES_WIDTH 256
|
||||
#define KS_NES_HEIGHT 228
|
||||
|
||||
#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_PRGROM_SIZE 0x80000 // 512kb for MMC3
|
||||
#define KS_NES_CHRROM_SIZE 0x40000 // 256kb for MMC3
|
||||
|
||||
#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_DRAW_RESULT_BUF_SIZE 0x1C800
|
||||
|
||||
#define KS_NES_SAVE_DATA_HEADER_SIZE
|
||||
#define KS_NES_WRAM_SIZE 0x800 // 2kb
|
||||
|
||||
#define KS_NES_EMU_STACK_SIZE 0x1000 // 4kb for thread stack
|
||||
|
||||
#define KS_NES_BYTES_PER_KB (1024)
|
||||
#define KS_NES_TO_KB(b) ((f32)b / (1.0f / (f32)KS_NES_BYTES_PER_KB))
|
||||
#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];
|
||||
typedef struct ksNesCommonWorkPriv {
|
||||
/* 0x0000 */ u8 wram[KS_NES_WRAM_SIZE];
|
||||
/* 0x0800 */ u8 _0800[0x0B40 - 0x0800];
|
||||
/* 0x0B40 */ u8 _0B40[1]; // TODO: figure out what this is and its size
|
||||
/* 0x0B41 */ u8 _0B41[0x2A40 - 0x0B41];
|
||||
/* 0x2A40 */ u8 _2A40[0x800];
|
||||
/* 0x3240 */ u8 _3240[0x8F18 - 0x3240];
|
||||
} ksNesCommonWorkPriv;
|
||||
|
||||
typedef struct ksNesCommonWorkObj {
|
||||
/* 0x0000 */ u8* nesromp;
|
||||
/* 0x0004 */ u8* noise_bufp;
|
||||
/* 0x0008 */ size_t chr_to_i8_buf_size;
|
||||
/* 0x000C */ u8* chr_to_u8_bufp;
|
||||
/* 0x0010 */ u8* result_bufp;
|
||||
/* 0x0014 */ int _0014;
|
||||
/* 0x0018 */ int _0018;
|
||||
/* 0x001C */ u8 frames;
|
||||
/* 0x001D */ u8 _001D;
|
||||
/* 0x001E */ u8 _001E;
|
||||
/* 0x001F */ u8 _001F;
|
||||
/* 0x0020 */ u32 pads[4];
|
||||
/* 0x0030 */ u32 _0030;
|
||||
/* 0x0034 */ u32 _0034;
|
||||
/* 0x0038 */ u32 _0038;
|
||||
/* 0x003C */ u8 _003C[0x0048 - 0x003C];
|
||||
/* 0x0048 */ size_t prg_size;
|
||||
/* 0x004C */ u8 _004C[0x0060 - 0x004C];
|
||||
/* 0x0060 */ ksNesCommonWorkPriv work_priv;
|
||||
} ksNesCommonWorkObj;
|
||||
|
||||
typedef struct ks_nes_state_obj_s {
|
||||
/* 0x0000 */ u8 wram[2048];
|
||||
/* 0x0800 */ u8 _temp[0x1A78 - 0x800];
|
||||
typedef struct ksNesStateObj {
|
||||
/* 0x0000 */ u8 wram[KS_NES_WRAM_SIZE];
|
||||
/* 0x0800 */ u8 _0800[0x16B4 - 0x0800];
|
||||
/* 0x16B4 */ u32 _16B4;
|
||||
/* 0x16BC */ u8 _16B8[0x176D - 0x16B8];
|
||||
/* 0x176D */ u8 disk_motor;
|
||||
/* 0x176E */ u8 _176E[0x17FC - 0x176E];
|
||||
/* 0x17FC */ u8 _17FC[8];
|
||||
/* 0x1804 */ u8 _1804[0x1844 - 0x1804];
|
||||
/* 0x1844 */ u16 PC;
|
||||
/* 0x1846 */ u8 _1846[0x1860 - 0x1846];
|
||||
/* 0x1860 */ size_t prg_size;
|
||||
/* 0x1864 */ size_t chr_size;
|
||||
/* 0x1868 */ u8 _1868[0x1A78 - 0x1868];
|
||||
} ksNesStateObj;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -4,14 +4,8 @@
|
||||
#include "types.h"
|
||||
#include "Famicom/ks_nes_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
extern int ksNesReset(ksNesCommonWorkObj* wp, ksNesStateObj* sp, u32 flags, u8* chrramp, u8* bbramp);
|
||||
extern void ksNesEmuFrame(ksNesCommonWorkObj* wp, ksNesStateObj* sp, u32 flags);
|
||||
extern void ksNesPushResetButton(ksNesStateObj* sp);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,14 +4,8 @@
|
||||
#include "types.h"
|
||||
#include "Famicom/ks_nes_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
extern void ksNesDrawInit(ksNesCommonWorkObj* wp);
|
||||
extern void ksNesDraw(ksNesCommonWorkObj* wp, ksNesStateObj* sp);
|
||||
extern void ksNesDrawEnd();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
#ifndef _JSYSTEM_J2D_J2DGRAFCONTEXT_H
|
||||
#define _JSYSTEM_J2D_J2DGRAFCONTEXT_H
|
||||
|
||||
#include "types.h"
|
||||
#include "JSystem/JGeometry.h"
|
||||
#include "JSystem/J2D/J2DTypes.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "dolphin/mtx.h"
|
||||
|
||||
/**
|
||||
* @fabricated
|
||||
*/
|
||||
enum J2DGrafType {
|
||||
J2DGraf_Base = 0,
|
||||
J2DGraf_Ortho = 1,
|
||||
J2DGraf_Persp = 2,
|
||||
};
|
||||
|
||||
struct J2DGrafBlend {
|
||||
u8 mType; // _00
|
||||
u8 mSrcFactor; // _01
|
||||
u8 mDestFactor; // _02
|
||||
};
|
||||
|
||||
struct J2DGrafContext {
|
||||
J2DGrafContext(f32, f32, f32, f32);
|
||||
|
||||
virtual ~J2DGrafContext() { } // _08 (weak)
|
||||
virtual void place(const JGeometry::TBox2f&); // _0C
|
||||
virtual void place(f32 x, f32 y, f32 width, f32 height)
|
||||
{
|
||||
JGeometry::TBox2f box(x, y, x + width, y + height);
|
||||
place(box);
|
||||
} // _10 (weak)
|
||||
virtual void setPort(); // _14
|
||||
virtual void setup2D(); // _18
|
||||
virtual void setScissor(); // _1C
|
||||
virtual J2DGrafType getGrafType() const { return J2DGraf_Base; } // _20 (weak)
|
||||
virtual void setLookat() { } // _24 (weak)
|
||||
|
||||
void drawFrame(const JGeometry::TBox2f&);
|
||||
void fillBox(const JGeometry::TBox2f&);
|
||||
void lineTo(JGeometry::TVec2f);
|
||||
|
||||
void lineTo(f32 x, f32 y) { lineTo(JGeometry::TVec2f(x, y)); }
|
||||
void moveTo(f32 x, f32 y) { moveTo(JGeometry::TVec2f(x, y)); }
|
||||
|
||||
void moveTo(JGeometry::TVec2f pos) { mPrevPos = pos; }
|
||||
|
||||
void scissor(const JGeometry::TBox2f&);
|
||||
void setColor(JUtility::TColor c) { setColor(c, c, c, c); }
|
||||
void setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
|
||||
void setLineWidth(u8);
|
||||
|
||||
// inlined
|
||||
void line(JGeometry::TVec2f, JGeometry::TVec2f);
|
||||
|
||||
// _00 VTBL
|
||||
JGeometry::TBox2f mBounds; // _04
|
||||
JGeometry::TBox2f mScissorBounds; // _14
|
||||
JUtility::TColor mColorTL; // _24, top left
|
||||
JUtility::TColor mColorTR; // _28, top right
|
||||
JUtility::TColor mColorBR; // _2C, bottom right
|
||||
JUtility::TColor mColorBL; // _30, bottom left
|
||||
u8 mLineWidth; // _34
|
||||
JGeometry::TVec2f mPrevPos; // _38
|
||||
Mtx44 mMtx44; // _40
|
||||
GC_Mtx mPosMtx; // _80
|
||||
J2DGrafBlend _B0; // _B0
|
||||
J2DGrafBlend mLinePart; // _B3
|
||||
J2DGrafBlend mBoxPart; // _B6
|
||||
};
|
||||
|
||||
struct J2DPerspGraph : public J2DGrafContext {
|
||||
J2DPerspGraph();
|
||||
|
||||
virtual ~J2DPerspGraph() { } // _08 (weak)
|
||||
virtual void setPort(); // _14
|
||||
virtual J2DGrafType getGrafType() const { return J2DGraf_Persp; } // _20 (weak)
|
||||
virtual void setLookat(); // _24
|
||||
|
||||
void makeLookat();
|
||||
void set(f32, f32, f32);
|
||||
void setFovy(f32);
|
||||
|
||||
inline f32 getFovY() const { return mFovY; }
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_BC = J2DGrafContext
|
||||
f32 mFovY; // _BC
|
||||
f32 _C0; // _C0
|
||||
f32 _C4; // _C4
|
||||
f32 _C8; // _C8
|
||||
};
|
||||
|
||||
struct J2DOrthoGraph : public J2DGrafContext {
|
||||
J2DOrthoGraph();
|
||||
J2DOrthoGraph(f32, f32, f32, f32, f32, f32);
|
||||
|
||||
virtual ~J2DOrthoGraph() {}; // _08 (weak)
|
||||
virtual void setPort(); // _14
|
||||
virtual J2DGrafType getGrafType() const { return J2DGraf_Ortho; }; // _20 (weak)
|
||||
virtual void setLookat(); // _24
|
||||
|
||||
void setOrtho(JGeometry::TBox2f const&, f32, f32);
|
||||
void scissorBounds(JGeometry::TBox2f*, JGeometry::TBox2f const*);
|
||||
|
||||
f32 getWidthPower() const { return mBounds.getWidth() / mOrtho.getWidth(); }
|
||||
f32 getHeightPower() const { return mBounds.getHeight() / mOrtho.getHeight(); }
|
||||
|
||||
void setOrtho(f32 param_0, f32 param_1, f32 param_2, f32 param_3, f32 param_4, f32 param_5)
|
||||
{
|
||||
JGeometry::TBox2<f32> ortho(param_0, param_1, param_0 + param_2, param_1 + param_3);
|
||||
setOrtho(ortho, param_4, param_5);
|
||||
}
|
||||
|
||||
// _00 = VTBL
|
||||
// _00-_BC = J2DGrafContext
|
||||
JGeometry::TBox2f mOrtho; // _BC
|
||||
f32 mNear; // _CC
|
||||
f32 mFar; // _D0
|
||||
};
|
||||
|
||||
void J2DFillBox(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor color);
|
||||
void J2DFillBox(JGeometry::TBox2f const& param_0, JUtility::TColor param_1);
|
||||
void J2DFillBox(f32, f32, f32, f32, JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
|
||||
void J2DFillBox(const JGeometry::TBox2f&, JUtility::TColor, JUtility::TColor, JUtility::TColor, JUtility::TColor);
|
||||
|
||||
void J2DDrawFrame(f32 param_0, f32 param_1, f32 param_2, f32 param_3, JUtility::TColor param_4, u8 param_5);
|
||||
void J2DDrawFrame(JGeometry::TBox2f const& param_0, JUtility::TColor param_1, u8 param_2);
|
||||
|
||||
void J2DDrawLine(f32, f32, f32, f32, JUtility::TColor, int);
|
||||
|
||||
#endif
|
||||
+361
-7
@@ -1,9 +1,363 @@
|
||||
#ifndef JGEOMETRY_H
|
||||
#define JGEOMETRY_H
|
||||
#ifndef _JSYSTEM_JGEOMETRY_H
|
||||
#define _JSYSTEM_JGEOMETRY_H
|
||||
|
||||
#include "JSystem/JGeometry/Vec.h"
|
||||
#include "JSystem/JGeometry/Box.h"
|
||||
#include "JSystem/JGeometry/Util.h"
|
||||
#endif
|
||||
#include "types.h"
|
||||
|
||||
#endif
|
||||
inline f32 fsqrt_step(f32 mag)
|
||||
{
|
||||
f32 root = __frsqrte(mag);
|
||||
return 0.5f * root * (3.0f - mag * (root * root));
|
||||
}
|
||||
|
||||
namespace JGeometry {
|
||||
template <typename T>
|
||||
struct TVec2 {
|
||||
TVec2() { }
|
||||
TVec2(T v) { set(v); }
|
||||
TVec2(T x, T y) { set(x, y); }
|
||||
|
||||
void set(T v) { y = x = v; }
|
||||
|
||||
void set(T x, T y)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
}
|
||||
|
||||
void set(const TVec2& other)
|
||||
{
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
}
|
||||
|
||||
void setMin(const TVec2<f32>& min)
|
||||
{
|
||||
if (x >= min.x)
|
||||
x = min.x;
|
||||
if (y >= min.y)
|
||||
y = min.y;
|
||||
}
|
||||
|
||||
void setMax(const TVec2<f32>& max)
|
||||
{
|
||||
if (x <= max.x)
|
||||
x = max.x;
|
||||
if (y <= max.y)
|
||||
y = max.y;
|
||||
}
|
||||
|
||||
void add(const TVec2<T>& other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
}
|
||||
|
||||
/** @fabricated */
|
||||
// TVec2<T> adding(const TVec2<T>& other) { return TVec2<T>(x + other.x, y + other.y); }
|
||||
|
||||
/** @fabricated */
|
||||
TVec2<T> adding(T xDelta, T yDelta) { return TVec2<T>(x + xDelta, y + yDelta); }
|
||||
|
||||
/** @fabricated */
|
||||
void add(T xDelta, T yDelta)
|
||||
{
|
||||
x += xDelta;
|
||||
y += yDelta;
|
||||
}
|
||||
|
||||
TVec2<T>& operator+=(const TVec2<T>& other)
|
||||
{
|
||||
x += other.x;
|
||||
y += other.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
TVec2<T>& operator*=(const TVec2<T>& other)
|
||||
{
|
||||
x *= other.x;
|
||||
y *= other.y;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool isAbove(const TVec2<T>& other) const { return (x >= other.x) && (y >= other.y) ? true : false; }
|
||||
|
||||
T x;
|
||||
T y;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct TVec3 {
|
||||
// inline TVec3() { }
|
||||
// inline TVec3(T value)
|
||||
// : x(value)
|
||||
// , y(value)
|
||||
// , z(value)
|
||||
// {
|
||||
// }
|
||||
// inline TVec3(T inX, T inY, T inZ)
|
||||
// : x(inX)
|
||||
// , y(inY)
|
||||
// , z(inZ) {};
|
||||
|
||||
// // TODO: Determine if this could've actually existed, or if I'm just making it up.
|
||||
// inline TVec3(const TVec3<T>& other)
|
||||
// {
|
||||
// x = other.x;
|
||||
// y = other.y;
|
||||
// z = other.z;
|
||||
// }
|
||||
|
||||
// TODO: Determine if this could've actually existed, or if I'm just making
|
||||
// it up.
|
||||
inline TVec3& operator=(const TVec3& other)
|
||||
{
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
z = other.z;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void set(T x, T y, T z)
|
||||
{
|
||||
this->x = x;
|
||||
this->y = y;
|
||||
this->z = z;
|
||||
}
|
||||
|
||||
void set(const TVec3& other)
|
||||
{
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
z = other.z;
|
||||
}
|
||||
|
||||
void setMin(const TVec3<f32>& min)
|
||||
{
|
||||
if (x >= min.x)
|
||||
x = min.x;
|
||||
if (y >= min.y)
|
||||
y = min.y;
|
||||
if (z >= min.z)
|
||||
z = min.z;
|
||||
}
|
||||
|
||||
void setMax(const TVec3<f32>& max)
|
||||
{
|
||||
if (x <= max.x)
|
||||
x = max.x;
|
||||
if (y <= max.y)
|
||||
y = max.y;
|
||||
if (z >= max.z)
|
||||
z = max.z;
|
||||
}
|
||||
|
||||
// inline operator Vec() const { return *this; }
|
||||
inline operator Vec() const
|
||||
{
|
||||
Vec other;
|
||||
other.x = x;
|
||||
other.y = y;
|
||||
other.z = z;
|
||||
return other;
|
||||
}
|
||||
|
||||
// inline TVec3(Vec& vec)
|
||||
// {
|
||||
// x = vec.x;
|
||||
// y = vec.y;
|
||||
// z = vec.z;
|
||||
// }
|
||||
|
||||
void zero() { x = y = z = 0.0f; }
|
||||
|
||||
f32 squared() const { return x * x + y * y + z * z; }
|
||||
|
||||
void normalize()
|
||||
{
|
||||
f32 sq = squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
return;
|
||||
}
|
||||
f32 norm;
|
||||
if (sq <= 0.0f) {
|
||||
norm = sq;
|
||||
} else {
|
||||
norm = fsqrt_step(sq);
|
||||
}
|
||||
x *= norm;
|
||||
y *= norm;
|
||||
z *= norm;
|
||||
}
|
||||
|
||||
void normalize(const TVec3<f32>& other)
|
||||
{
|
||||
f32 sq = other.squared();
|
||||
if (sq <= FLT_EPSILON * 32.0f) {
|
||||
zero();
|
||||
return;
|
||||
}
|
||||
f32 norm;
|
||||
if (sq <= 0.0f) {
|
||||
norm = sq;
|
||||
} else {
|
||||
norm = fsqrt_step(sq);
|
||||
}
|
||||
x = other.x * norm;
|
||||
y = other.y * norm;
|
||||
z = other.z * norm;
|
||||
}
|
||||
|
||||
bool isAbove(const TVec3<T>& other) const { return (x >= other.x) && (y >= other.y) && (z >= other.z); }
|
||||
|
||||
T x;
|
||||
T y;
|
||||
T z;
|
||||
};
|
||||
|
||||
// Size: 0x10
|
||||
template <class T>
|
||||
struct TBox {
|
||||
TBox()
|
||||
: i()
|
||||
, f()
|
||||
{
|
||||
}
|
||||
TBox(const TBox& other)
|
||||
: i(other.f)
|
||||
, f(other.y)
|
||||
{
|
||||
}
|
||||
|
||||
T i, f;
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
template<> struct TBox<TVec2<f32> > {
|
||||
inline f32 getWidth() const { return f.x - i.x; }
|
||||
inline f32 getHeight() const { return f.y - i.y; }
|
||||
|
||||
bool isValid() const { return f.isAbove(i); }
|
||||
|
||||
void addPos(f32 x, f32 y) {
|
||||
addPos(TVec2<f32>(x, y));
|
||||
}
|
||||
|
||||
void addPos(const TVec2<f32>& pos) {
|
||||
i.add(pos);
|
||||
f.add(pos);
|
||||
}
|
||||
|
||||
bool intersect(const TBox<TVec2<f32> >& other) {
|
||||
i.setMax(other.i);
|
||||
f.setMin(other.f);
|
||||
return isValid();
|
||||
}
|
||||
|
||||
TVec2<f32> i, f;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct TBox2 : TBox<TVec2<T> > {
|
||||
TBox2() {}
|
||||
// TBox2(const TBox2& other) { set(other); }
|
||||
TBox2(const TVec2<T>& i, const TVec2<T> f) { set(i, f); }
|
||||
// TBox2(const TVec2<T>& i, T x1, T y1) { set(i, x1, y1); }
|
||||
// TBox2(T x0, T y0, const TVec2<T>& f) { set(x0, y0, f); }
|
||||
TBox2(f32 x0, f32 y0, f32 x1, f32 y1) { set(x0, y0, x1, y1); }
|
||||
TBox2(f32 x0, f32 y0, TVec2<f32>& f) { set(x0, y0, x0 + f.x, y0 + f.y); }
|
||||
TBox2(f32 val)
|
||||
{
|
||||
f.y = val;
|
||||
f.x = val;
|
||||
i.y = val;
|
||||
i.x = val;
|
||||
}
|
||||
|
||||
// inline TBox2& operator=(const TBox2& other)
|
||||
// {
|
||||
// set(other);
|
||||
// return *this;
|
||||
// }
|
||||
|
||||
void absolute() {
|
||||
if (!this->isValid()) {
|
||||
TBox2<T> box(*this);
|
||||
this->i.setMin(box.i);
|
||||
this->i.setMin(box.f);
|
||||
this->f.setMax(box.i);
|
||||
this->f.setMax(box.f);
|
||||
}
|
||||
}
|
||||
|
||||
inline void setX(const T& x) {
|
||||
this->f.x = this->i.x = x;
|
||||
}
|
||||
|
||||
inline void setY(const T& y) {
|
||||
this->f.y = this->i.y = y;
|
||||
}
|
||||
|
||||
// /** @fabricated */
|
||||
// TBox2<T>& addingPos(TBox2<T>& result, const TVec2<T>& pos) {
|
||||
// return TBox2<T>(i.adding(pos), f.adding(pos));
|
||||
// }
|
||||
|
||||
void set(const TBox2& other) { set(other.i, other.f); }
|
||||
void set(const TVec2<T>& i, const TVec2<T>& f) { this->i.set(i), this->f.set(f); }
|
||||
// void set(const TVec2<T>& i, T x1, T y1) { this->i.set(i), this->f.set(x1, y1); }
|
||||
// void set(T x0, T y0, const TVec2<T>& f) { this->i.set(x0, y0), this->f.set(f); }
|
||||
void set(T x0, T y0, T x1, T y1) { this->i.set(x0, y0); this->f.set(x1, y1); }
|
||||
|
||||
// void setOrigin(const TVec2<T>& other) { this->i.set(other); }
|
||||
// void setSize(T width, T height) { this->f.x = this->i.x + width; this->f.y = this->i.y + height; }
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
template <typename T>
|
||||
struct TBox3 {
|
||||
// TBox3() {}
|
||||
// TBox2(const TBox2& other) { set(other); }
|
||||
// TBox3(const TVec3<T>& i, const TVec3<T> f) { set(i, f); }
|
||||
// // TBox2(const TVec2<T>& i, T x1, T y1) { set(i, x1, y1); }
|
||||
// // TBox2(T x0, T y0, const TVec2<T>& f) { set(x0, y0, f); }
|
||||
// TBox3(T x0, T y0, T z0, T x1, T y1, T z1) { set(x0, y0, z0, x1, y1, z1); }
|
||||
// TBox3(T x0, T y0, TVec3<T>& f) { set(x0, y0, z0, x0 + f.x, y0 + f.y, z0 + f.z); }
|
||||
// TBox3(T val)
|
||||
// {
|
||||
// f.x = f.y = f.z = val;
|
||||
// i.x = i.y = i.z = val;
|
||||
// }
|
||||
|
||||
inline bool isValid() { return mMax.isAbove(mMin); }
|
||||
|
||||
void absolute()
|
||||
{
|
||||
if (!this->isValid()) {
|
||||
TBox3<T> box(*this);
|
||||
this->mMin.setMin(box.mMin);
|
||||
this->mMin.setMin(box.mMax);
|
||||
this->mMax.setMax(box.mMin);
|
||||
this->mMax.setMax(box.mMax);
|
||||
}
|
||||
}
|
||||
|
||||
void set(const TBox3& other) { set(other.mMin, other.mMax); }
|
||||
void set(const TVec3<T>& i, const TVec3<T>& f) { this->mMin.set(i), this->mMax.set(f); }
|
||||
void set(T x0, T y0, T z0, T x1, T y1, T z1)
|
||||
{
|
||||
this->mMin.set(x0, y0);
|
||||
this->mMax.set(x1, y1);
|
||||
}
|
||||
|
||||
TVec3<T> mMin; // _00
|
||||
TVec3<T> mMax; // _0C
|
||||
};
|
||||
|
||||
typedef TVec2<f32> TVec2f;
|
||||
typedef TVec3<f32> TVec3f;
|
||||
typedef TBox2<f32> TBox2f;
|
||||
typedef TBox3<f32> TBox3f;
|
||||
|
||||
} // namespace JGeometry
|
||||
|
||||
#endif
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JKernel/JKRDvdFile.h"
|
||||
#include "JSystem/JKernel/JKRThread.h"
|
||||
#include "JSystem/JKernel/JKRAram.h"
|
||||
#include "JSystem/JKernel/JKREnum.h"
|
||||
|
||||
#define JKRDECOMP_MSG_BUF_COUNT 4
|
||||
#define JKRDECOMP_STACK_SIZE 0x4000
|
||||
|
||||
@@ -19,7 +19,7 @@ class JKRFileFinder
|
||||
{
|
||||
public:
|
||||
JKRFileFinder()
|
||||
: mIsAvailable(false), mIsFileOrDir(false)
|
||||
: mIsAvailable(false), mIsDir(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public:
|
||||
// _00 = VTBL
|
||||
|
||||
bool mIsAvailable; // _10
|
||||
bool mIsFileOrDir; // _11
|
||||
bool mIsDir; // _11
|
||||
};
|
||||
|
||||
class JKRArcFinder : public JKRFileFinder
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace JUTAssertion
|
||||
#define JUT_MAX_ASSERT(...)
|
||||
#define JUT_LOG_F(...)
|
||||
|
||||
#ifndef DEBUG
|
||||
#if defined(DEBUG) || 1
|
||||
#define JUT_ASSERT(...)
|
||||
#define JUT_ASSERT_F(...)
|
||||
#else
|
||||
|
||||
@@ -4,6 +4,6 @@
|
||||
void* JC_JUTDbPrint_getManager(void);
|
||||
void JC_JUTDbPrint_setVisible(void*, int); // I know these are C++ but these were used to match a c function so I'll fix these when I need them or fix zurumode update.
|
||||
|
||||
|
||||
void JUTReport(int x, int y, int show_count, const char* fmt, ...);
|
||||
|
||||
#endif
|
||||
@@ -126,10 +126,12 @@ public:
|
||||
return JUTGamePad::sClampMode;
|
||||
}
|
||||
|
||||
static s8 getPortStatus(EPadPort port) {
|
||||
/* @HACK - This gets inlined when defined -- JSystem might have precompiled headers */
|
||||
static s8 getPortStatus(EPadPort port);
|
||||
/*{
|
||||
JUT_ASSERT(0 <= port && port < 4);
|
||||
return mPadStatus[port].err;
|
||||
}
|
||||
}*/
|
||||
|
||||
bool isPushing3ButtonReset() const {
|
||||
bool pushing = false;
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
#ifndef _JUTPROCBAR_H
|
||||
#define _JUTPROCBAR_H
|
||||
|
||||
#include "dolphin/os.h"
|
||||
#include "dolphin/os/OSTime.h"
|
||||
#include "JSystem/JUtility/TColor.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
#include "types.h"
|
||||
|
||||
class JUTProcBar
|
||||
{
|
||||
public:
|
||||
struct CTime
|
||||
{
|
||||
CTime() { clear(); }
|
||||
|
||||
void clear()
|
||||
{
|
||||
mCost = 0;
|
||||
_08 = 0;
|
||||
_0C = 0;
|
||||
}
|
||||
|
||||
void start(u8 red, u8 green, u8 blue)
|
||||
{
|
||||
mR = red;
|
||||
mG = green;
|
||||
mB = blue;
|
||||
mStartTick = OSGetTick();
|
||||
}
|
||||
|
||||
void end()
|
||||
{
|
||||
mCost = OSTicksToMicroseconds(OSDiffTick(OSGetTick(), mStartTick));
|
||||
if (mCost == 0)
|
||||
mCost = 1;
|
||||
}
|
||||
|
||||
void accumePeek()
|
||||
{
|
||||
//u32 prev = ++_0C;
|
||||
if (++_0C >= 0x10 || mCost >= _08)
|
||||
{
|
||||
_08 = mCost;
|
||||
_0C = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int calcBarSize(int p1, int p2) { return mCost * p1 / p2; }
|
||||
|
||||
u32 mStartTick; // _00
|
||||
u32 mCost; // _04
|
||||
u32 _08; // _08
|
||||
u32 _0C; // _0C
|
||||
u8 mR; // _10
|
||||
u8 mG; // _11
|
||||
u8 mB; // _12
|
||||
};
|
||||
|
||||
struct CParamSet {
|
||||
void setBarWidth(int w) { mBarWidth = w; };
|
||||
void setWidth(int w) { mWidth = w; }
|
||||
void setUserPosition(int pos) { mUserPosition = pos; }
|
||||
void setPosition(int x, int y)
|
||||
{
|
||||
mPosX = x;
|
||||
mPosY = y;
|
||||
}
|
||||
|
||||
/* 0x00 */ int mBarWidth;
|
||||
/* 0x04 */ int mPosX;
|
||||
/* 0x08 */ int mPosY;
|
||||
/* 0x0C */ int mWidth;
|
||||
/* 0x10 */ int mUserPosition;
|
||||
};
|
||||
|
||||
JUTProcBar(); // unused / inlined
|
||||
~JUTProcBar(); // unused / inlined
|
||||
|
||||
static JUTProcBar* create();
|
||||
static void destroy();
|
||||
static void clear();
|
||||
|
||||
void draw();
|
||||
void drawProcessBar();
|
||||
void drawHeapBar();
|
||||
|
||||
// Unused Functions / Inlines
|
||||
void bar_subroutine(int, int, int, int, int, int, int, JUtility::TColor, JUtility::TColor);
|
||||
void adjustMeterLength(u32, f32 *, f32, f32, int *);
|
||||
void getUnuseUserBar();
|
||||
|
||||
u32 getGpCost() const {
|
||||
return mGp.mCost;
|
||||
}
|
||||
|
||||
u32 getCpuCost() const {
|
||||
return mCpu.mCost;
|
||||
}
|
||||
|
||||
u32 getUserCost(int idx) {
|
||||
return sManager->mUsers[idx].mCost;
|
||||
}
|
||||
|
||||
static JUTProcBar* getManager() {
|
||||
return sManager;
|
||||
}
|
||||
|
||||
void idleStart() { mIdle.start(255, 129, 30); }
|
||||
void idleEnd() { mIdle.end(); }
|
||||
void gpStart() { mGp.start(255, 129, 30); }
|
||||
void gpEnd() { mGp.end(); }
|
||||
void cpuStart() { mCpu.start(255, 129, 30); }
|
||||
void cpuEnd() { mCpu.end(); }
|
||||
void gpWaitStart() { mGpWait.start(255, 129, 30); }
|
||||
void gpWaitEnd() { mGpWait.end(); }
|
||||
void wholeLoopStart() { mWholeLoop.start(255, 129, 30); }
|
||||
void wholeLoopEnd() { mWholeLoop.end(); }
|
||||
|
||||
void setCostFrame(int frame) { mCostFrame = frame; }
|
||||
void setVisible(bool visible) { mVisible = visible; }
|
||||
bool isVisible() { return mVisible; }
|
||||
void setHeapBarVisible(bool visible) { mHeapBarVisible = visible; }
|
||||
void userStart(int idx, u8 p2, u8 p3, u8 p4) {
|
||||
sManager->mUsers[idx].start(p2, p3, p4);
|
||||
sManager->_108 |= 1 << idx;
|
||||
}
|
||||
|
||||
inline u32 calcGPUTime() { // fabricated
|
||||
return mGp.mCost - mGpWait.mCost;
|
||||
}
|
||||
|
||||
int calcBarHeight() { // fabricated
|
||||
return mParams.mBarWidth * 2;
|
||||
}
|
||||
|
||||
static JUTProcBar* sManager; // might be private too
|
||||
private:
|
||||
CTime mIdle; // _00
|
||||
CTime mGp; // _14
|
||||
CTime mCpu; // _28
|
||||
CTime mGpWait; // _3C
|
||||
CTime mWholeLoop; // _50
|
||||
CTime mUsers[8]; // _64
|
||||
int mCostFrame; // _104
|
||||
u32 _108; // _108, active users?
|
||||
bool mVisible; // _10C
|
||||
int _110; // _110
|
||||
CParamSet mParams; // _114
|
||||
int _128; // _128
|
||||
JKRHeap* mWatchHeap; // _12C
|
||||
bool mHeapBarVisible; // _130
|
||||
}; // 0x134 size
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,56 @@
|
||||
#ifndef _JSYSTEM_RESTIMG_H
|
||||
#define _JSYSTEM_RESTIMG_H
|
||||
|
||||
#include "dolphin/gx.h"
|
||||
#include "types.h"
|
||||
|
||||
#ifndef _JUTTransparency
|
||||
typedef u8 _JUTTransparency;
|
||||
#endif
|
||||
|
||||
enum {
|
||||
ResTIMG_FORMAT_C8 = 9
|
||||
// TODO: others
|
||||
};
|
||||
|
||||
enum {
|
||||
ResTIMG_NO_PALETTE,
|
||||
ResTIMG_PALETTE
|
||||
};
|
||||
|
||||
struct ResTIMG {
|
||||
inline BOOL isMIPmapEnabled() const { return (mIsMIPmapEnabled > 0); }
|
||||
|
||||
inline u16 getWidth() const { return mSizeX; }
|
||||
inline u16 getHeight() const { return mSizeY; }
|
||||
|
||||
u8 mTextureFormat; // _00
|
||||
_JUTTransparency mTransparency; // _01
|
||||
u16 mSizeX; // _02
|
||||
u16 mSizeY; // _04
|
||||
u8 mWrapS; // _06
|
||||
u8 mWrapT; // _07
|
||||
u8 mPaletteFormat; // _08
|
||||
u8 mColorFormat; // _09
|
||||
u16 mPaletteEntryCount; // _0A
|
||||
u32 mPaletteOffset; // _0C
|
||||
GXBool mIsMIPmapEnabled; // _10
|
||||
GXBool mDoEdgeLOD; // _11
|
||||
GXBool mIsBiasClamp; // _12
|
||||
GXBool mIsMaxAnisotropy; // _13
|
||||
u8 mMinFilterType; // _14
|
||||
u8 mMagFilterType; // _15
|
||||
s8 mMinLOD; // _16
|
||||
s8 mMaxLOD; // _17
|
||||
u8 mTotalImageCount; // _18
|
||||
u8 _19; // _19, unknown
|
||||
s16 mLODBias; // _1A
|
||||
u32 mImageDataOffset; // _1C
|
||||
};
|
||||
|
||||
struct ResTIMGPair {
|
||||
ResTIMG _00;
|
||||
ResTIMG _20;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -4,8 +4,16 @@
|
||||
#include "types.h"
|
||||
#include "va_args.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void vprintf(const char*, va_list);
|
||||
extern void printf(const char*, ...);
|
||||
int snprintf(char* s, size_t n, const char* format, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
#ifndef _DOLPHIN_CARD
|
||||
#define _DOLPHIN_CARD
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define CARD_ENCODE_ANSI 0u
|
||||
#define CARD_ENCODE_SJIS 1u
|
||||
|
||||
/* Sizes */
|
||||
#define CARD_WORKAREA_SIZE (5 * 8 * 1024)
|
||||
#define CARD_READ_SIZE 512
|
||||
#define CARD_MAX_FILE 127
|
||||
#define CARD_COMMENT_SIZE 64
|
||||
#define CARD_FILENAME_MAX 32
|
||||
#define CARD_ICON_MAX 8
|
||||
#define CARD_ICON_WIDTH 32
|
||||
#define CARD_ICON_HEIGHT 32
|
||||
#define CARD_BANNER_WIDTH 96
|
||||
#define CARD_BANNER_HEIGHT 32
|
||||
|
||||
/* Icon animation */
|
||||
#define CARD_MODE_NORMAL 0
|
||||
#define CARD_MODE_FAST 1
|
||||
|
||||
#define CARDGetBannerFormat(stat) (((stat)->bannerFormat) & CARD_STAT_BANNER_MASK)
|
||||
#define CARDGetIconAnim(stat) (((stat)->bannerFormat) & CARD_STAT_ANIM_MASK)
|
||||
#define CARDGetIconFormat(stat, n) (((stat)->iconFormat >> (2 * (n))) & CARD_STAT_ICON_MASK)
|
||||
#define CARDGetIconSpeed(stat, n) (((stat)->iconSpeed >> (2 * (n))) & CARD_STAT_SPEED_MASK)
|
||||
#define CARDSetBannerFormat(stat, f) \
|
||||
((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_BANNER_MASK) | (f)))
|
||||
#define CARDSetIconAnim(stat, f) \
|
||||
((stat)->bannerFormat = (u8)(((stat)->bannerFormat & ~CARD_STAT_ANIM_MASK) | (f)))
|
||||
#define CARDSetIconFormat(stat, n, f) \
|
||||
((stat)->iconFormat = \
|
||||
(u16)(((stat)->iconFormat & ~(CARD_STAT_ICON_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
|
||||
#define CARDSetIconSpeed(stat, n, f) \
|
||||
((stat)->iconSpeed = \
|
||||
(u16)(((stat)->iconSpeed & ~(CARD_STAT_SPEED_MASK << (2 * (n)))) | ((f) << (2 * (n)))))
|
||||
#define CARDSetIconAddress(stat, addr) ((stat)->iconAddr = (u32)(addr))
|
||||
#define CARDSetCommentAddress(stat, addr) ((stat)->commentAddr = (u32)(addr))
|
||||
#define CARDGetFileNo(fileInfo) ((fileInfo)->fileNo)
|
||||
|
||||
#define CARD_NUM_CHANS 2
|
||||
|
||||
#define CARD_RESULT_UNLOCKED 1
|
||||
#define CARD_RESULT_READY 0
|
||||
#define CARD_RESULT_BUSY -1
|
||||
#define CARD_RESULT_WRONGDEVICE -2
|
||||
#define CARD_RESULT_NOCARD -3
|
||||
#define CARD_RESULT_NOFILE -4
|
||||
#define CARD_RESULT_IOERROR -5
|
||||
#define CARD_RESULT_BROKEN -6
|
||||
#define CARD_RESULT_EXIST -7
|
||||
#define CARD_RESULT_NOENT -8
|
||||
#define CARD_RESULT_INSSPACE -9
|
||||
#define CARD_RESULT_NOPERM -10
|
||||
#define CARD_RESULT_LIMIT -11
|
||||
#define CARD_RESULT_NAMETOOLONG -12
|
||||
#define CARD_RESULT_ENCODING -13
|
||||
#define CARD_RESULT_CANCELED -14
|
||||
#define CARD_RESULT_FATAL_ERROR -128
|
||||
|
||||
#define CARD_STAT_ICON_NONE 0
|
||||
#define CARD_STAT_ICON_C8 1
|
||||
#define CARD_STAT_ICON_RGB5A3 2
|
||||
#define CARD_STAT_ICON_MASK 3
|
||||
|
||||
#define CARD_STAT_BANNER_NONE 0
|
||||
#define CARD_STAT_BANNER_C8 1
|
||||
#define CARD_STAT_BANNER_RGB5A3 2
|
||||
#define CARD_STAT_BANNER_MASK 3
|
||||
|
||||
#define CARD_STAT_ANIM_LOOP 0x00
|
||||
#define CARD_STAT_ANIM_BOUNCE 0x04
|
||||
#define CARD_STAT_ANIM_MASK 0x04
|
||||
|
||||
#define CARD_STAT_SPEED_END 0
|
||||
#define CARD_STAT_SPEED_FAST 1
|
||||
#define CARD_STAT_SPEED_MIDDLE 2
|
||||
#define CARD_STAT_SPEED_SLOW 3
|
||||
#define CARD_STAT_SPEED_MASK 3
|
||||
|
||||
#define CARD_ATTR_PUBLIC 0x04u
|
||||
#define CARD_ATTR_NO_COPY 0x08u
|
||||
#define CARD_ATTR_NO_MOVE 0x10u
|
||||
#define CARD_ATTR_GLOBAL 0x20u
|
||||
#define CARD_ATTR_COMPANY 0x40u
|
||||
|
||||
typedef struct CARDFileInfo {
|
||||
s32 chan;
|
||||
s32 fileNo;
|
||||
|
||||
s32 offset;
|
||||
s32 length;
|
||||
u16 iBlock;
|
||||
u16 __padding;
|
||||
} CARDFileInfo;
|
||||
|
||||
typedef struct CARDStat {
|
||||
char fileName[CARD_FILENAME_MAX];
|
||||
u32 length;
|
||||
u32 time; // seconds since 01/01/2000 midnight
|
||||
u8 gameName[4];
|
||||
u8 company[2];
|
||||
|
||||
u8 bannerFormat;
|
||||
u8 __padding;
|
||||
u32 iconAddr; // offset to the banner, bannerTlut, icon, iconTlut data set.
|
||||
u16 iconFormat;
|
||||
u16 iconSpeed;
|
||||
u32 commentAddr; // offset to the pair of 32 byte character strings.
|
||||
|
||||
u32 offsetBanner;
|
||||
u32 offsetBannerTlut;
|
||||
u32 offsetIcon[CARD_ICON_MAX];
|
||||
u32 offsetIconTlut;
|
||||
u32 offsetData;
|
||||
} CARDStat;
|
||||
|
||||
typedef void (*CARDCallback)(s32 chan, s32 result);
|
||||
|
||||
void CARDInit(void);
|
||||
BOOL CARDGetFastMode(void);
|
||||
BOOL CARDSetFastMode(BOOL enable);
|
||||
|
||||
s32 CARDCheck(s32 chan);
|
||||
s32 CARDCheckAsync(s32 chan, CARDCallback callback);
|
||||
s32 CARDCheckEx(s32 chan, s32* xferBytes);
|
||||
s32 CARDCheckExAsync(s32 chan, s32* xferBytes, CARDCallback callback);
|
||||
s32 CARDCreate(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo);
|
||||
s32 CARDCreateAsync(s32 chan, const char* fileName, u32 size, CARDFileInfo* fileInfo,
|
||||
CARDCallback callback);
|
||||
s32 CARDDelete(s32 chan, const char* fileName);
|
||||
s32 CARDDeleteAsync(s32 chan, const char* fileName, CARDCallback callback);
|
||||
s32 CARDFastDelete(s32 chan, s32 fileNo);
|
||||
s32 CARDFastDeleteAsync(s32 chan, s32 fileNo, CARDCallback callback);
|
||||
s32 CARDFastOpen(s32 chan, s32 fileNo, CARDFileInfo* fileInfo);
|
||||
s32 CARDFormat(s32 chan);
|
||||
s32 CARDFormatAsync(s32 chan, CARDCallback callback);
|
||||
s32 CARDFreeBlocks(s32 chan, s32* byteNotUsed, s32* filesNotUsed);
|
||||
s32 CARDGetAttributes(s32 chan, s32 fileNo, u8* attr);
|
||||
s32 CARDGetEncoding(s32 chan, u16* encode);
|
||||
s32 CARDGetMemSize(s32 chan, u16* size);
|
||||
s32 CARDGetResultCode(s32 chan);
|
||||
s32 CARDGetSectorSize(s32 chan, u32* size);
|
||||
s32 CARDGetSerialNo(s32 chan, u64* serialNo);
|
||||
s32 CARDGetStatus(s32 chan, s32 fileNo, CARDStat* stat);
|
||||
s32 CARDGetXferredBytes(s32 chan);
|
||||
s32 CARDMount(s32 chan, void* workArea, CARDCallback detachCallback);
|
||||
s32 CARDMountAsync(s32 chan, void* workArea, CARDCallback detachCallback,
|
||||
CARDCallback attachCallback);
|
||||
s32 CARDOpen(s32 chan, const char* fileName, CARDFileInfo* fileInfo);
|
||||
BOOL CARDProbe(s32 chan);
|
||||
s32 CARDProbeEx(s32 chan, s32* memSize, s32* sectorSize);
|
||||
s32 CARDRename(s32 chan, const char* oldName, const char* newName);
|
||||
s32 CARDRenameAsync(s32 chan, const char* oldName, const char* newName, CARDCallback callback);
|
||||
s32 CARDSetAttributesAsync(s32 chan, s32 fileNo, u8 attr, CARDCallback callback);
|
||||
s32 CARDSetAttributes(s32 chan, s32 fileNo, u8 attr);
|
||||
s32 CARDSetStatus(s32 chan, s32 fileNo, CARDStat* stat);
|
||||
s32 CARDSetStatusAsync(s32 chan, s32 fileNo, CARDStat* stat, CARDCallback callback);
|
||||
s32 CARDUnmount(s32 chan);
|
||||
s32 CARDGetCurrentMode(s32 chan, u32* mode);
|
||||
s32 CARDCancel(CARDFileInfo* fileInfo);
|
||||
s32 CARDClose(CARDFileInfo* fileInfo);
|
||||
s32 CARDRead(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset);
|
||||
s32 CARDReadAsync(CARDFileInfo* fileInfo, void* addr, s32 length, s32 offset,
|
||||
CARDCallback callback);
|
||||
s32 CARDWrite(CARDFileInfo* fileInfo, const void* addr, s32 length, s32 offset);
|
||||
s32 CARDWriteAsync(CARDFileInfo* fileInfo, const void* addr, s32 length, s32 offset,
|
||||
CARDCallback callback);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // _DOLPHIN_CARD
|
||||
@@ -179,6 +179,7 @@ typedef enum _GXCITexFmt {
|
||||
GX_TF_C14X2 = 0xa,
|
||||
} GXCITexFmt;
|
||||
|
||||
// TODO: fix
|
||||
typedef enum _GXTexWrapMode {
|
||||
GX_CLAMP,
|
||||
GX_REPEAT,
|
||||
|
||||
@@ -120,6 +120,12 @@ static inline void GXTexCoord2s16(s16 u, s16 v) {
|
||||
GXWGFifo.s16 = v;
|
||||
}
|
||||
|
||||
static inline void GXPosition2s16(s16 x, s16 y)
|
||||
{
|
||||
GXWGFifo.s16 = x;
|
||||
GXWGFifo.s16 = y;
|
||||
}
|
||||
|
||||
static inline void GXPosition2u16(u16 x, u16 y)
|
||||
{
|
||||
GXWGFifo.u16 = x;
|
||||
|
||||
+66
-7
@@ -7,8 +7,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef float Mtx[3][4];
|
||||
typedef float Mtx44[4][4];
|
||||
/////////////// TYPE DEFINES ///////////////
|
||||
#define MTXDegToRad(a) ((a)*0.01745329252f)
|
||||
|
||||
typedef struct {
|
||||
f32 x;
|
||||
@@ -16,11 +16,70 @@ typedef struct {
|
||||
f32 z;
|
||||
} Vec;
|
||||
|
||||
void PSMTXConcat(const Mtx, const Mtx, Mtx);
|
||||
void PSMTXCopy(const Mtx, Mtx);
|
||||
void PSMTXIdentity(Mtx);
|
||||
void PSMTXTranspose(const Mtx, Mtx);
|
||||
u32 PSMTXInverse(const Mtx, Mtx);
|
||||
typedef f32 Mtx34[3][4];
|
||||
typedef f32 Mtx23[2][3];
|
||||
typedef f32 Mtx33[3][3];
|
||||
typedef f32 Mtx44[4][4];
|
||||
typedef f32 (*MtxP)[4];
|
||||
typedef f32 PSQuaternion[4];
|
||||
typedef Mtx34 GC_Mtx; // TODO: fix this
|
||||
|
||||
typedef struct Quaternion {
|
||||
f32 x, y, z, w;
|
||||
} Quaternion;
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
////// PAIRED SINGLE MATRIX FUNCTIONS //////
|
||||
void PSMTXIdentity(GC_Mtx mtx);
|
||||
void PSMTXCopy(const GC_Mtx src, GC_Mtx dest);
|
||||
void PSMTXConcat(const GC_Mtx A, const GC_Mtx B, GC_Mtx concat);
|
||||
|
||||
void PSMTXTranspose(const GC_Mtx src, GC_Mtx xPose);
|
||||
u32 PSMTXInverse(const GC_Mtx src, GC_Mtx inv);
|
||||
|
||||
void __PSMTXRotAxisRadInternal(GC_Mtx mtx, const Vec* axis, f32 sinA, f32 cosA);
|
||||
void PSMTXRotRad(GC_Mtx mtx, char axis, f32 angle);
|
||||
void PSMTXRotTrig(GC_Mtx mtx, char axis, f32 sinA, f32 cosA);
|
||||
void PSMTXRotAxisRad(GC_Mtx mtx, const Vec* axis, f32 angle);
|
||||
|
||||
void PSMTXTrans(GC_Mtx mtx, f32 xT, f32 yT, f32 zT);
|
||||
void PSMTXTransApply(const GC_Mtx src, GC_Mtx dest, f32 xT, f32 yT, f32 zT);
|
||||
|
||||
void PSMTXScale(GC_Mtx mtx, f32 xS, f32 yS, f32 zS);
|
||||
void PSMTXScaleApply(const GC_Mtx src, GC_Mtx dest, f32 xS, f32 yS, f32 zS);
|
||||
void PSMTXQuat(GC_Mtx mtx, const PSQuaternion* quat);
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
//// PAIRED SINGLE MATRIX VEC FUNCTIONS ////
|
||||
void PSMTXMultVec(const GC_Mtx, const Vec*, Vec*);
|
||||
void PSMTXMultVecSR(const GC_Mtx, const Vec*, Vec*);
|
||||
void PSMTXMultVecArraySR(const GC_Mtx, f32*, f32*, f32*);
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
/////////// MATRIX44 FUNCTIONS ////////////
|
||||
void PSMTX44Copy(Mtx44 src, Mtx44 dest);
|
||||
void C_MTXPerspective(Mtx44 mtx, f32 fovY, f32 aspect, f32 n, f32 f);
|
||||
void C_MTXOrtho(Mtx44 mtx, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f);
|
||||
////////////////////////////////////////////
|
||||
|
||||
///////// CODED C MATRIX FUNCTIONS /////////
|
||||
void C_MTXLookAt(GC_Mtx, const Vec*, const Vec*, const Vec*);
|
||||
void C_MTXLightPerspective(GC_Mtx mtx, f32 fovY, f32 aspect, f32 scaleS, f32 scaleT, f32 transS, f32 transT);
|
||||
void C_MTXLightOrtho(GC_Mtx mtx, f32 t, f32 b, f32 l, f32 r, f32 scaleS, f32 scaleT, f32 transS, f32 transT);
|
||||
////////////////////////////////////////////
|
||||
|
||||
////////////// MATRIX INLINES //////////////
|
||||
static inline void MTXSetPosition(GC_Mtx mtx, const Vec* pos)
|
||||
{
|
||||
mtx[0][3] = pos->x;
|
||||
mtx[1][3] = pos->y;
|
||||
mtx[2][3] = pos->z;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -9,6 +9,11 @@ extern "C" {
|
||||
|
||||
#define PAD_CONTROLLER_NUM 4
|
||||
|
||||
#define PAD_ERR_NONE 0
|
||||
#define PAD_ERR_NO_CONTROLLER -1
|
||||
#define PAD_ERR_NOT_READY -2
|
||||
#define PAD_ERR_TRANSFER -3
|
||||
|
||||
#define PAD_MOTOR_STOP 0
|
||||
#define PAD_MOTOR_RUMBLE 1
|
||||
#define PAD_MOTOR_STOP_HARD 2
|
||||
|
||||
@@ -16,6 +16,7 @@ int stricmp(char*, char*);
|
||||
char* strcpy(char*, const char*);
|
||||
char* strcat(char* dst, const char* src);
|
||||
char* strncpy(char* dst, const char* src, size_t n);
|
||||
char* strstr(const char* str, const char* pat);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "types.h"
|
||||
#include "game.h"
|
||||
#include "Famicom/famicom.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -13,7 +14,7 @@ typedef struct game_famicom_emu_s {
|
||||
/* 0x00 */ GAME game;
|
||||
} GAME_FAMICOM_EMU;
|
||||
|
||||
extern void* my_malloc_func[];
|
||||
extern Famicom_MallocInfo my_malloc_func;
|
||||
|
||||
extern void famicom_emu_main(GAME* game);
|
||||
extern void famicom_emu_init(GAME* game);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef EMUSOUND_H
|
||||
#define EMUSOUND_H
|
||||
|
||||
#include "types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void EmuSound_Start(u8* noise_data);
|
||||
extern void EmuSound_Exit();
|
||||
extern void Sound_Write(u16 event, u8 value, u16 maybe_frames);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,8 +1,14 @@
|
||||
#ifndef SPRINTF_H
|
||||
#define SPRINTF_H
|
||||
|
||||
#include "types.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
s32 sprintf(char* dst, const char* fmt, ...);
|
||||
int sprintf(char* dst, const char* fmt, ...);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -139,6 +139,13 @@ extern s32 JW_Resize(void* ptr, size_t new_size);
|
||||
extern size_t JW_GetMemBlockSize(void* ptr);
|
||||
extern void JW_JUTReport(int x, int y, int show_count, const char* fmt, ...);
|
||||
|
||||
extern int JC_JKRDecomp_checkCompressed(u8* bufp);
|
||||
extern void JC_JKRDecomp_decode(u8* comp_bufp, u8* decomp_bufp, u32 decomp_buf_size, u32 skipCount);
|
||||
|
||||
extern void* JC__JKRMountArchive(const char* path, int mount_mode, void* heap, int mount_direction);
|
||||
|
||||
extern void* JC__JKRGetSystemHeap();
|
||||
|
||||
#ifdef JSYSWRAPPER_DEBUG
|
||||
#define JSYSWRAPPER_PRINTF(console, fmt, ...) JC_JUTConsole_print_f(console, fmt, ...)
|
||||
#else
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ typedef struct {
|
||||
PersonalID_c pid[PLAYER_NUM];
|
||||
} mCD_persistent_data_c;
|
||||
|
||||
extern u8 mCD_GetThisLandSlotNo_code(int* player_no, int* slot_card_results);
|
||||
extern s32 mCD_GetThisLandSlotNo_code(int* player_no, s32* slot_card_results);
|
||||
extern void mCD_save_data_aram_malloc();
|
||||
extern void mCD_set_aram_save_data();
|
||||
extern void mCD_init_card();
|
||||
|
||||
@@ -8,24 +8,6 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define BUTTON_NONE 0x0000
|
||||
#define BUTTON_CRIGHT 0x0001
|
||||
#define BUTTON_CLEFT 0x0002
|
||||
#define BUTTON_CDOWN 0x0004
|
||||
#define BUTTON_CUP 0x0008
|
||||
#define BUTTON_R 0x0010
|
||||
#define BUTTON_L 0x0020
|
||||
#define BUTTON_X 0x0040
|
||||
#define BUTTON_Y 0x0080
|
||||
#define BUTTON_DRIGHT 0x0100
|
||||
#define BUTTON_DLEFT 0x0200
|
||||
#define BUTTON_DDOWN 0x0400
|
||||
#define BUTTON_DUP 0x0800
|
||||
#define BUTTON_START 0x1000
|
||||
#define BUTTON_Z 0x2000
|
||||
#define BUTTON_B 0x4000
|
||||
#define BUTTON_A 0x8000
|
||||
|
||||
#define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0)
|
||||
|
||||
/* sizeof(struct controller_s) == 0x38 */
|
||||
|
||||
@@ -64,6 +64,24 @@ typedef u32 unknown;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BUTTON_NONE 0x0000
|
||||
#define BUTTON_CRIGHT 0x0001
|
||||
#define BUTTON_CLEFT 0x0002
|
||||
#define BUTTON_CDOWN 0x0004
|
||||
#define BUTTON_CUP 0x0008
|
||||
#define BUTTON_R 0x0010
|
||||
#define BUTTON_L 0x0020
|
||||
#define BUTTON_X 0x0040
|
||||
#define BUTTON_Y 0x0080
|
||||
#define BUTTON_DRIGHT 0x0100
|
||||
#define BUTTON_DLEFT 0x0200
|
||||
#define BUTTON_DDOWN 0x0400
|
||||
#define BUTTON_DUP 0x0800
|
||||
#define BUTTON_START 0x1000
|
||||
#define BUTTON_Z 0x2000
|
||||
#define BUTTON_B 0x4000
|
||||
#define BUTTON_A 0x8000
|
||||
|
||||
#define ARRAY_SIZE(arr, type) (sizeof(arr) / sizeof(type))
|
||||
#define ARRAY_COUNT(arr) (int)(sizeof(arr) / sizeof(arr[0]))
|
||||
|
||||
|
||||
+6
-6
@@ -38,12 +38,12 @@ static void my_alloc_cleanup() {
|
||||
zelda_CleanupArena();
|
||||
}
|
||||
|
||||
static void my_zelda_getmemblocksize(void* ptr) {
|
||||
zelda_GetMemBlockSize(ptr);
|
||||
static int my_zelda_getmemblocksize(void* ptr) {
|
||||
return zelda_GetMemBlockSize(ptr);
|
||||
}
|
||||
|
||||
static void my_zelda_gettotalfreesize() {
|
||||
zelda_GetTotalFreeSize();
|
||||
static int my_zelda_gettotalfreesize() {
|
||||
return zelda_GetTotalFreeSize();
|
||||
}
|
||||
|
||||
static void* my_zelda_malloc_align(size_t size, u32 align) {
|
||||
@@ -59,7 +59,7 @@ static void my_zelda_free(void* ptr) {
|
||||
zelda_free(ptr);
|
||||
}
|
||||
|
||||
void* my_malloc_func[] = {
|
||||
Famicom_MallocInfo my_malloc_func = {
|
||||
my_zelda_malloc_align,
|
||||
my_zelda_free,
|
||||
my_zelda_getmemblocksize,
|
||||
@@ -151,7 +151,7 @@ extern void famicom_emu_init(GAME* game) {
|
||||
|
||||
my_alloc_init(game, freeXfbBase, freeXfbSize);
|
||||
|
||||
if (famicom_init(rom_id, my_malloc_func, player) != 0) {
|
||||
if (famicom_init(rom_id, &my_malloc_func, player) != 0) {
|
||||
Common_Set(famicom_2DBAC, Common_Get(famicom_2DBAC) | 1);
|
||||
return_emu_game(game);
|
||||
}
|
||||
|
||||
+2
-2
@@ -414,7 +414,7 @@ void play_cleanup(GAME* game){
|
||||
mCD_toNextLand();
|
||||
mEA_CleanCardDLProgram();
|
||||
|
||||
if(my_malloc_current == my_malloc_func){
|
||||
if(my_malloc_current == &my_malloc_func){
|
||||
my_malloc_current = NULL;
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ void play_init(GAME* game){
|
||||
zelda_InitArena((void*)aligned, freebytes - size);
|
||||
|
||||
if(my_malloc_current == NULL){
|
||||
my_malloc_current = my_malloc_func;
|
||||
my_malloc_current = &my_malloc_func;
|
||||
}
|
||||
|
||||
mFM_FieldInit(play);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,8 +30,8 @@ static u32 nesinfo_rom_size = 0;
|
||||
static u8* nesinfo_rom_start = nullptr;
|
||||
static u8* nesinfo_rom_end = nullptr;
|
||||
static u32 nesinfo_expand_rom_size = 0;
|
||||
static bool tcs_bad = false;
|
||||
static bool ics_bad = false;
|
||||
u8 tcs_bad = false;
|
||||
u8 ics_bad = false;
|
||||
|
||||
// clang-format off
|
||||
|
||||
@@ -839,7 +839,7 @@ extern void nesinfo_tag_process1(u8* save_data, int mode, u32* max_ofs_p) {
|
||||
|
||||
OSReport("ロムデータ参照: %d\n", rom_id); // Referencing ROM data: %d\n
|
||||
if (nesrom_filename_ptrs != nullptr && rom_p != nullptr) {
|
||||
nesinfo_data_size = JKRFileLoader::readGlbResource(rom_p, 0x100000, nesrom_filename_ptrs[rom_id],
|
||||
nesinfo_data_size = JKRFileLoader::readGlbResource(rom_p, 0x100000, (char*)nesrom_filename_ptrs[rom_id],
|
||||
EXPAND_SWITCH_DECOMPRESS);
|
||||
nesinfo_data_start = rom_p;
|
||||
nesinfo_data_end = rom_p + nesinfo_data_size;
|
||||
|
||||
@@ -27,7 +27,7 @@ bool JKRArcFinder::findNextFile()
|
||||
mBase.mFileIndex = mNextIndex;
|
||||
mBase.mFileID = dirEntry.mID;
|
||||
mBase.mFileTypeFlags = dirEntry.mFlags;
|
||||
mIsFileOrDir = FLAG_OFF(mBase.mFileTypeFlags, 2);
|
||||
mIsDir = FLAG_OFF(mBase.mFileTypeFlags, 2);
|
||||
mNextIndex++;
|
||||
}
|
||||
}
|
||||
@@ -51,12 +51,12 @@ bool JKRDvdFinder::findNextFile()
|
||||
mIsAvailable = DVDReadDir(&mDir, &entry);
|
||||
if (mIsAvailable)
|
||||
{
|
||||
mIsFileOrDir = (bool)entry.isDir;
|
||||
mIsDir = (bool)entry.isDir;
|
||||
mBase.mFileName = entry.name;
|
||||
mBase.mFileIndex = entry.entryNum;
|
||||
mBase.mFileID = 0;
|
||||
|
||||
mBase.mFileTypeFlags = mIsFileOrDir ? 2 : 1;
|
||||
mBase.mFileTypeFlags = mIsDir ? 2 : 1;
|
||||
}
|
||||
}
|
||||
return mIsAvailable;
|
||||
|
||||
@@ -323,23 +323,23 @@ extern void JW_getPadStatus(PADStatus* padStatus) {
|
||||
}
|
||||
|
||||
extern int JW_JUTGamepad_getErrorStatus() {
|
||||
return (s8)gamePad[0].mErrorStatus;
|
||||
return (s8)((JUTGamePad*)gamePad)[0].mErrorStatus;
|
||||
}
|
||||
|
||||
extern u32 JW_JUTGamepad_getButton() {
|
||||
return gamePad[0].mButtons.mButton;
|
||||
return ((JUTGamePad*)gamePad)[0].mButtons.mButton;
|
||||
}
|
||||
|
||||
extern u32 JW_JUTGamepad_getTrigger() {
|
||||
return gamePad[0].mButtons.mTrigger;
|
||||
return ((JUTGamePad*)gamePad)[0].mButtons.mTrigger;
|
||||
}
|
||||
|
||||
extern f32 JW_JUTGamepad_getSubStickValue() {
|
||||
return gamePad[0].mSubStick.mValue;
|
||||
return ((JUTGamePad*)gamePad)[0].mSubStick.mValue;
|
||||
}
|
||||
|
||||
extern int JW_JUTGamepad_getSubStickAngle() {
|
||||
return gamePad[0].mSubStick.mAngle;
|
||||
return ((JUTGamePad*)gamePad)[0].mSubStick.mAngle;
|
||||
}
|
||||
|
||||
static bool FrameDrawing = false;
|
||||
|
||||
@@ -8,8 +8,8 @@ static void* proutPrintf(void* dst, const char* fmt, int size) {
|
||||
return (void*)((u8*)memcpy(dst, fmt, size) + size);
|
||||
}
|
||||
|
||||
s32 sprintf(char* dst, const char* fmt, ...) {
|
||||
s32 ret;
|
||||
int sprintf(char* dst, const char* fmt, ...) {
|
||||
int ret;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user