Skip to content

Commit

Permalink
Some progress on frame.c (#56)
Browse files Browse the repository at this point in the history
* frame progress

* review
  • Loading branch information
Yanis002 authored Sep 25, 2024
1 parent 522a825 commit b6a2700
Show file tree
Hide file tree
Showing 7 changed files with 2,438 additions and 3,036 deletions.
2 changes: 2 additions & 0 deletions config/oot-j/splits.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ emulator/frame.c:
.text start:0x80049370 end:0x80055D74
.rodata start:0x8016A7A0 end:0x8016A7C0
.data start:0x801726C0 end:0x80172FF0
.bss start:0x801A14A0 end:0x801C7CE0
.sdata start:0x8025C818 end:0x8025C838
.sbss start:0x8025D068 end:0x8025D0B8
.sdata2 start:0x8025DD90 end:0x8025DE68

emulator/library.c:
Expand Down
31 changes: 14 additions & 17 deletions config/oot-j/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,10 @@ fn_8004B940 = .text:0x8004B940; // type:function size:0x220
fn_8004BB60 = .text:0x8004BB60; // type:function size:0x128
CopyAndConvertCFB = .text:0x8004BC88; // type:function size:0x16C
fn_8004BDF4 = .text:0x8004BDF4; // type:function size:0x150
fn_8004BF44 = .text:0x8004BF44; // type:function size:0x14
frameDrawSyncCallback = .text:0x8004BF44; // type:function size:0x14
fn_8004BF58 = .text:0x8004BF58; // type:function size:0x2F4
frameDrawDone = .text:0x8004C24C; // type:function size:0x7C
fn_8004C2C8 = .text:0x8004C2C8; // type:function size:0x108
frameMakeTLUT = .text:0x8004C2C8; // type:function size:0x108
frameMakePixels = .text:0x8004C3D0; // type:function size:0x1790
frameLoadTexture = .text:0x8004DB60; // type:function size:0x2E4
frameDrawSetup2D = .text:0x8004DE44; // type:function size:0x1B0
Expand Down Expand Up @@ -6687,15 +6687,12 @@ lbl_801A1468 = .bss:0x801A1468; // type:object size:0x38
lbl_801A14A0 = .bss:0x801A14A0; // type:object size:0x20
lbl_801A14C0 = .bss:0x801A14C0; // type:object size:0x180
lbl_801A1640 = .bss:0x801A1640; // type:object size:0x20
lbl_801A1660 = .bss:0x801A1660; // type:object size:0x20
sFrameObj_1647 = .bss:0x801A1660; // type:object size:0x20
lbl_801A1680 = .bss:0x801A1680; // type:object size:0x20
lbl_801A16A0 = .bss:0x801A16A0; // type:object size:0x200 data:2byte
lbl_801A18A0 = .bss:0x801A18A0; // type:object size:0x18 data:4byte
lbl_801A18B8 = .bss:0x801A18B8; // type:object size:0xA08 data:2byte
lbl_801A22C0 = .bss:0x801A22C0; // type:object size:0x119E0
lbl_801B3CA0 = .bss:0x801B3CA0; // type:object size:0x13E0
lbl_801B5080 = .bss:0x801B5080; // type:object size:0x11F40
lbl_801C6FC0 = .bss:0x801C6FC0; // type:object size:0xB00
tempLine = .bss:0x801A16A0; // type:object size:0x200 data:2byte
sConstantBufAddr = .bss:0x801A18A0; // type:object size:0x18 data:4byte
line_1630 = .bss:0x801A18B8; // type:object size:0xA00 data:2byte
sTempZBuf = .bss:0x801A22C0; // type:object size:0x25800
lbl_801C7AC0 = .bss:0x801C7AC0; // type:object size:0x200
lbl_801C7CC0 = .bss:0x801C7CC0; // type:object size:0x20
lbl_801C7CE0 = .bss:0x801C7CE0; // type:object size:0x20
Expand Down Expand Up @@ -6987,7 +6984,7 @@ lbl_8025C818 = .sdata:0x8025C818; // type:object size:0x6 data:string
lbl_8025C820 = .sdata:0x8025C820; // type:object size:0x2 data:string
cAlpha = .sdata:0x8025C822; // type:object size:0x1 data:byte
sRemapI = .sdata:0x8025C828; // type:object size:0x8
lbl_8025C830 = .sdata:0x8025C830; // type:object size:0x4 data:string
lbl_8025C830 = .sdata:0x8025C830; // type:object size:0x5 data:string
lbl_8025C838 = .sdata:0x8025C838; // type:object size:0x4 data:float
lbl_8025C83C = .sdata:0x8025C83C; // type:object size:0x4 data:float
lbl_8025C840 = .sdata:0x8025C840; // type:object size:0x8 data:4byte
Expand Down Expand Up @@ -7336,22 +7333,22 @@ cpuCompile_DSRLV_function = .sbss:0x8025D060; // type:object size:0x4 data:4byte
cpuCompile_DSLLV_function = .sbss:0x8025D064; // type:object size:0x4 data:4byte
snScissorChanged = .sbss:0x8025D068; // type:object size:0x4 data:4byte
gNoSwapBuffer = .sbss:0x8025D06C; // type:object size:0x4 data:4byte
lbl_8025D070 = .sbss:0x8025D070; // type:object size:0x4 data:4byte
lbl_8025D074 = .sbss:0x8025D074; // type:object size:0x1 data:byte
gHackCreditsColor = .sbss:0x8025D070; // type:object size:0x4 data:4byte
sSpecialZeldaHackON = .sbss:0x8025D074; // type:object size:0x1 data:byte
lbl_8025D078 = .sbss:0x8025D078; // type:object size:0x4 data:4byte
lbl_8025D07C = .sbss:0x8025D07C; // type:object size:0x4 data:4byte
lbl_8025D080 = .sbss:0x8025D080; // type:object size:0x4 data:4byte
sNumAddr = .sbss:0x8025D080; // type:object size:0x4 data:4byte
lbl_8025D084 = .sbss:0x8025D084; // type:object size:0x4 data:4byte
lbl_8025D088 = .sbss:0x8025D088; // type:object size:0x4 data:4byte
lbl_8025D08C = .sbss:0x8025D08C; // type:object size:0x4 data:4byte
sSrcBuffer = .sbss:0x8025D088; // type:object size:0x4 data:4byte
sDestinationBuffer = .sbss:0x8025D08C; // type:object size:0x4 data:4byte
lbl_8025D090 = .sbss:0x8025D090; // type:object size:0x4 data:float
lbl_8025D094 = .sbss:0x8025D094; // type:object size:0x4 data:float
lbl_8025D098 = .sbss:0x8025D098; // type:object size:0x4 data:4byte
snScissorHeight = .sbss:0x8025D09C; // type:object size:0x4 data:4byte
snScissorWidth = .sbss:0x8025D0A0; // type:object size:0x4 data:4byte
snScissorYOrig = .sbss:0x8025D0A4; // type:object size:0x4 data:4byte
snScissorXOrig = .sbss:0x8025D0A8; // type:object size:0x4 data:4byte
lbl_8025D0AC = .sbss:0x8025D0AC; // type:object size:0x4 data:4byte
sCopyFrameSyncReceived = .sbss:0x8025D0AC; // type:object size:0x4 data:4byte
gbFrameBegin = .sbss:0x8025D0B0; // type:object size:0x4 data:4byte
gbFrameValid = .sbss:0x8025D0B4; // type:object size:0x4 data:4byte
lbl_8025D0B8 = .sbss:0x8025D0B8; // type:object size:0x1 data:byte
Expand Down
19 changes: 18 additions & 1 deletion include/emulator/frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ typedef enum FrameColorType {
FCT_COUNT
} FrameColorType;

typedef struct Texture64 {
/* 0x00 */ s32 magic; // 'VC64'
/* 0x04 */ u32 nTypeROM; // `SystemRomType`
/* 0x08 */ u32 unk_34;
/* 0x0C */ s32 nSizeX;
/* 0x10 */ s32 nSizeY;
/* 0x14 */ GXTexWrapMode eWrapS;
/* 0x18 */ GXTexWrapMode eWrapT;
/* 0x1C */ s32 nMode;
/* 0x20 */ GXTexFmt eFormat;
/* 0x24 */ u32 nAddress;
/* 0x28 */ u32 nCodePixel;
/* 0x2C */ u32 nCodeColor;
/* 0x30 */ u32 nData0;
/* 0x34 */ u32 nData1;
} Texture64; // size = 0x38

typedef struct Primitive {
/* 0x0 */ s32 nCount;
/* 0x4 */ u8 anData[768];
Expand Down Expand Up @@ -306,7 +323,7 @@ typedef struct Frame {
/* 0x0226C */ FrameTexture aTexture[2048];
/* 0x3A26C */ u32 anTextureUsed[64];
/* 0x3A36C */ FrameTexture* apTextureCached[4096];
/* 0x3E36C */ s32 unk_3E36C;
/* 0x3E36C */ FrameTexture* unk_3E36C;
/* 0x3E370 */ s32 iTileLoad;
/* 0x3E374 */ u32 n2dLoadTexType;
/* 0x3E378 */ s32 nLastX0;
Expand Down
21 changes: 21 additions & 0 deletions include/revolution/os/OSFastCast.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,27 @@ static inline s16 __OSf32tos16(register f32 arg) {

static inline void OSf32tos16(const f32* in, s16* out) { *out = __OSf32tos16(*in); }

static inline u8 __OSf32tou8(register f32 arg) {
f32 a;
register f32* ptr = &a;
u8 r;

#ifdef __MWERKS__
// clang-format off
asm {
psq_st arg, 0(ptr), 1, OS_FASTCAST_U8
}
// clang-format on
r = *(u8*)ptr;
#else
r = (u8)arg;
#endif

return r;
}

static inline void OSf32tou8(f32* in, u8* out) { *out = __OSf32tou8(*in); }

static inline f32 __OSu8tof32(register u8* arg) {
register f32 ret;

Expand Down
Loading

0 comments on commit b6a2700

Please sign in to comment.