Skip to content

Commit ed7feb5

Browse files
authored
iFMV Equivalent (#411)
* iFMV Equivalent Needs dolsdk updates * Add missing dolphin headers for iFMV
1 parent 39db44d commit ed7feb5

35 files changed

+2782
-87
lines changed

configure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ def Rel(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
397397
Object(Matching, "SB/Core/gc/iDraw.cpp"),
398398
Object(Equivalent, "SB/Core/gc/iEnv.cpp"),
399399
Object(NonMatching, "SB/Core/gc/iFile.cpp"),
400-
Object(NonMatching, "SB/Core/gc/iFMV.cpp"),
400+
Object(Equivalent, "SB/Core/gc/iFMV.cpp"),
401401
Object(NonMatching, "SB/Core/gc/iFX.cpp"),
402402
Object(Matching, "SB/Core/gc/iLight.cpp"),
403403
Object(Matching, "SB/Core/gc/iMath.cpp"),

include/bink/bink.h

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef __BINK_H__
22
#define __BINK_H__
33

4+
#include <size_t.h>
5+
46
#define BINKSURFACE8P 0
57
#define BINKSURFACE24 1
68
#define BINKSURFACE24R 2
@@ -22,6 +24,16 @@
2224
struct BINK
2325
{
2426
// Do the members really need to be defined?
27+
U32 unk_0;
28+
U32 unk_4;
29+
U32 unk_8;
30+
U32 unk_c;
31+
U32 unk_10;
32+
U32 unk_14;
33+
U32 unk_18;
34+
U32 unk_1c;
35+
U8 unk_20[0xd0];
36+
S32 unk_f0;
2537
};
2638

2739
typedef struct BINK* HBINK;
@@ -37,11 +49,23 @@ extern int BinkDoFrame(HBINK bnk);
3749
extern int BinkCopyToBuffer(HBINK bnk, void* dest, int destpitch, unsigned int destheight,
3850
unsigned int destx, unsigned int desty, unsigned int flags);
3951
extern int Lock_RAD_3D_image(HRAD3DIMAGE rad_image, void* out_pixel_buffer,
40-
unsigned int* out_buffer_pitch);
52+
unsigned int* out_buffer_pitch, unsigned int* arg3);
4153
extern void Unlock_RAD_3D_image(HRAD3DIMAGE rad_image);
54+
extern void Blit_RAD_3D_image(HRAD3DIMAGE Image, float, float, float, float, float);
55+
extern void RADSetAudioMemory(void* (*malloc)(size_t), void (*free)(void*));
56+
extern void RADSetMemory(void* (*malloc)(size_t), void (*free)(void*));
57+
extern HBINK BinkOpen(const char* fname, void*);
58+
extern void BinkGetError();
59+
extern void BinkSetVolume(HBINK bink, unsigned int, int volume);
60+
extern HRAD3DIMAGE Open_RAD_3D_image(HBINK bink, unsigned int, unsigned int, unsigned int);
61+
extern void Close_RAD_3D_image(HRAD3DIMAGE rad_image);
62+
extern void BinkGoto(HBINK bink, int frame, unsigned int);
63+
extern int BinkWait(HBINK bink);
64+
extern void BinkNextFrame(HBINK bink);
65+
extern void BinkClose(HBINK bink);
4266

4367
#ifdef __cplusplus
4468
}
4569
#endif
4670

47-
#endif
71+
#endif

include/dolphin/dolphin.h

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,6 @@ u8 __gUnknown800030E3 : (OS_BASE_CACHED | 0x30E3);
7575
extern "C" {
7676
#endif
7777

78-
typedef u8 GXBool;
79-
80-
#define GX_TRUE ((GXBool)1)
81-
#define GX_FALSE ((GXBool)0)
82-
#define GX_ENABLE ((GXBool)1)
83-
#define GX_DISABLE ((GXBool)0)
84-
8578
typedef struct DVDDiskID DVDDiskID;
8679

8780
struct DVDDiskID
@@ -235,17 +228,16 @@ extern volatile OSHeapHandle __OSCurrHeap;
235228
#define OSAlloc(size) OSAllocFromHeap(__OSCurrHeap, (size))
236229
#define OSFree(ptr) OSFreeToHeap(__OSCurrHeap, (ptr))
237230

238-
void ARAlloc(u32 size);
239-
void ARFree(void* mem);
240231
BOOL DVDFastOpen(s32 entrynum, DVDFileInfo* fileInfo);
241232
BOOL DVDReadAsyncPrio(DVDFileInfo* fileInfo, void* addr, s32 length, s32 offset,
242233
DVDCallback callback, s32 prio);
234+
s32 DVDCancel(volatile DVDCommandBlock* block);
243235
BOOL DVDClose(DVDFileInfo* fileInfo);
236+
int DVDSeekAsyncPrio(DVDFileInfo* fileInfo, s32 offset, void (*callback)(s32, DVDFileInfo*),
237+
s32 prio);
244238
s32 DVDGetCommandBlockStatus(const DVDCommandBlock* block);
245239
s32 DVDConvertPathToEntrynum(const char* pathPtr);
246240
BOOL DVDCancelAllAsync(DVDCBCallback callback);
247-
void GXSetColorUpdate(GXBool update_enable);
248-
void GXSetAlphaUpdate(GXBool update_enable);
249241
void OSPanic(const char* file, int line, const char* msg, ...);
250242
void* OSAllocFromHeap(OSHeapHandle heap, u32 size);
251243
void OSFreeToHeap(OSHeapHandle heap, void* ptr);
@@ -407,6 +399,12 @@ s32 CARDFormat(s32 chan);
407399
// CARDRdwr
408400
s32 CARDGetXferredBytes(s32 chan);
409401

402+
// GX
403+
#include <dolphin/mtx.h>
404+
#include <dolphin/vi.h>
405+
#include <dolphin/gx.h>
406+
#include <dolphin/ar.h>
407+
410408
#ifdef __cplusplus
411409
}
412410
#endif

include/dolphin/dolphin/ar.h

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#ifndef _DOLPHIN_AR_H_
2+
#define _DOLPHIN_AR_H_
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
typedef void (*ARQCallback)(u32 pointerToARQRequest);
9+
10+
struct ARQRequest {
11+
/* 0x00 */ struct ARQRequest *next;
12+
/* 0x04 */ u32 owner;
13+
/* 0x08 */ u32 type;
14+
/* 0x0C */ u32 priority;
15+
/* 0x10 */ u32 source;
16+
/* 0x14 */ u32 dest;
17+
/* 0x18 */ u32 length;
18+
/* 0x1C */ ARQCallback callback;
19+
};
20+
21+
#define ARQ_DMA_ALIGNMENT 32
22+
23+
#define ARAM_DIR_MRAM_TO_ARAM 0x00
24+
#define ARAM_DIR_ARAM_TO_MRAM 0x01
25+
26+
#define ARStartDMARead(mmem, aram, len) \
27+
ARStartDMA(ARAM_DIR_ARAM_TO_MRAM, mmem, aram, len)
28+
#define ARStartDMAWrite(mmem, aram, len) \
29+
ARStartDMA(ARAM_DIR_MRAM_TO_ARAM, mmem, aram, len)
30+
31+
typedef struct ARQRequest ARQRequest;
32+
33+
#define ARQ_TYPE_MRAM_TO_ARAM ARAM_DIR_MRAM_TO_ARAM
34+
#define ARQ_TYPE_ARAM_TO_MRAM ARAM_DIR_ARAM_TO_MRAM
35+
36+
#define ARQ_PRIORITY_LOW 0
37+
#define ARQ_PRIORITY_HIGH 1
38+
39+
// AR
40+
ARQCallback ARRegisterDMACallback(ARQCallback callback);
41+
u32 ARGetDMAStatus(void);
42+
void ARStartDMA(u32 type, u32 mainmem_addr, u32 aram_addr, u32 length);
43+
u32 ARAlloc(u32 length);
44+
u32 ARFree(u32* length);
45+
BOOL ARCheckInit(void);
46+
u32 ARInit(u32* stack_index_addr, u32 num_entries);
47+
void ARReset(void);
48+
void ARSetSize(void);
49+
u32 ARGetBaseAddress(void);
50+
u32 ARGetSize(void);
51+
u32 ARGetInternalSize(void);
52+
void ARClear(u32 flag);
53+
54+
// ARQ
55+
void ARQInit(void);
56+
void ARQReset(void);
57+
void ARQPostRequest(ARQRequest* request, u32 owner, u32 type, u32 priority, u32 source, u32 dest, u32 length, ARQCallback callback);
58+
void ARQRemoveRequest(ARQRequest* request);
59+
void ARQRemoveOwnerRequest(u32 owner);
60+
void ARQFlushQueue(void);
61+
void ARQSetChunkSize(u32 size);
62+
u32 ARQGetChunkSize(void);
63+
BOOL ARQCheckInit(void);
64+
65+
#ifdef __cplusplus
66+
}
67+
#endif
68+
69+
#endif

include/dolphin/dolphin/gx.h

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#ifndef _DOLPHIN_GX_H_
2+
#define _DOLPHIN_GX_H_
3+
4+
#include <dolphin/gx/GXStruct.h>
5+
#include <dolphin/gx/GXTransform.h>
6+
#include <dolphin/gx/GXTev.h>
7+
#include <dolphin/gx/GXPixel.h>
8+
#include <dolphin/gx/GXManage.h>
9+
#include <dolphin/gx/GXFifo.h>
10+
#include <dolphin/gx/GXCull.h>
11+
#include <dolphin/gx/GXGeometry.h>
12+
#include <dolphin/gx/GXVert.h>
13+
#include <dolphin/gx/GXTexture.h>
14+
#include <dolphin/gx/GXTev.h>
15+
#include <dolphin/gx/GXLighting.h>
16+
#include <dolphin/gx/GXDispList.h>
17+
#include <dolphin/gx/GXCommandList.h>
18+
#include <dolphin/gx/GXBump.h>
19+
#include <dolphin/gx/GXFrameBuffer.h>
20+
#include <dolphin/gx/GXGet.h>
21+
#include <dolphin/gx/GXDraw.h>
22+
#include <dolphin/gx/GXPerf.h>
23+
#include <dolphin/gx/GXCpu2Efb.h>
24+
#include <dolphin/gx/GXVerify.h>
25+
26+
// unsorted GX externs
27+
28+
#ifdef __cplusplus
29+
extern "C" {
30+
#endif
31+
32+
// GXMisc
33+
void (*GXSetDrawSyncCallback(void (*cb)(u16)))(u16);
34+
void GXSetDrawSync(u16 token);
35+
36+
#ifdef __cplusplus
37+
}
38+
#endif
39+
40+
#endif
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef _DOLPHIN_GX_GXBUMP_H_
2+
#define _DOLPHIN_GX_GXBUMP_H_
3+
4+
#include <dolphin/gx/GXEnum.h>
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
void GXSetTevIndirect(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexFormat format, GXIndTexBiasSel bias_sel, GXIndTexMtxID matrix_sel, GXIndTexWrap wrap_s, GXIndTexWrap wrap_t, GXBool add_prev, GXBool utc_lod, GXIndTexAlphaSel alpha_sel);
11+
void GXSetIndTexMtx(GXIndTexMtxID mtx_id, const f32 offset[2][3], s8 scale_exp);
12+
void GXSetIndTexCoordScale(GXIndTexStageID ind_state, GXIndTexScale scale_s, GXIndTexScale scale_t);
13+
void GXSetIndTexOrder(GXIndTexStageID ind_stage, GXTexCoordID tex_coord, GXTexMapID tex_map);
14+
void GXSetNumIndStages(u8 nIndStages);
15+
void GXSetTevDirect(GXTevStageID tev_stage);
16+
void GXSetTevIndWarp(GXTevStageID tev_stage, GXIndTexStageID ind_stage, u8 signed_offset, u8 replace_mode, GXIndTexMtxID matrix_sel);
17+
void GXSetTevIndTile(GXTevStageID tev_stage, GXIndTexStageID ind_stage, u16 tilesize_s,
18+
u16 tilesize_t, u16 tilespacing_s, u16 tilespacing_t, GXIndTexFormat format,
19+
GXIndTexMtxID matrix_sel, GXIndTexBiasSel bias_sel, GXIndTexAlphaSel alpha_sel);
20+
void GXSetTevIndBumpST(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexMtxID matrix_sel);
21+
void GXSetTevIndBumpXYZ(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexMtxID matrix_sel);
22+
void GXSetTevIndRepeat(GXTevStageID tev_stage);
23+
void __GXSetIndirectMask(u32 mask);
24+
25+
#ifdef __cplusplus
26+
}
27+
#endif
28+
29+
#endif
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#ifndef _DOLPHIN_GX_GXCOMMANDLIST_H_
2+
#define _DOLPHIN_GX_GXCOMMANDLIST_H_
3+
4+
#define GX_NOP 0x00
5+
#define GX_LOAD_CP_REG 0x08
6+
#define GX_LOAD_XF_REG 0x10
7+
#define GX_LOAD_INDX_A 0x20
8+
#define GX_LOAD_INDX_B 0x28
9+
#define GX_LOAD_INDX_C 0x30
10+
#define GX_LOAD_INDX_D 0x38
11+
#define GX_LOAD_BP_REG 0x61
12+
13+
#define GX_DRAW_QUADS 0x80
14+
#define GX_DRAW_TRIANGLES 0x90
15+
#define GX_DRAW_TRIANGLE_STRIP 0x98
16+
#define GX_DRAW_TRIANGLE_FAN 0xA0
17+
#define GX_DRAW_LINES 0xA8
18+
#define GX_DRAW_LINE_STRIP 0xB0
19+
#define GX_DRAW_POINTS 0xB8
20+
21+
#define GX_CMD_CALL_DL 0x40
22+
#define GX_CMD_INVAL_VTX 0x48
23+
24+
#define GX_OPCODE_MASK 0xF8
25+
#define GX_VAT_MASK 0x07
26+
27+
extern u8 GXTexMode0Ids[8];
28+
extern u8 GXTexMode1Ids[8];
29+
extern u8 GXTexImage0Ids[8];
30+
extern u8 GXTexImage1Ids[8];
31+
extern u8 GXTexImage2Ids[8];
32+
extern u8 GXTexImage3Ids[8];
33+
extern u8 GXTexTlutIds[8];
34+
35+
#endif
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef _DOLPHIN_GX_GXCPU2EFB_H_
2+
#define _DOLPHIN_GX_GXCPU2EFB_H_
3+
4+
#include <dolphin/gx/GXEnum.h>
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
void GXPokeAlphaMode(GXCompare func, u8 threshold);
11+
void GXPokeAlphaRead(GXAlphaReadMode mode);
12+
void GXPokeAlphaUpdate(GXBool update_enable);
13+
void GXPokeBlendMode(GXBlendMode type, GXBlendFactor src_factor, GXBlendFactor dst_factor, GXLogicOp op);
14+
void GXPokeColorUpdate(GXBool update_enable);
15+
void GXPokeDstAlpha(GXBool enable, u8 alpha);
16+
void GXPokeDither(GXBool dither);
17+
void GXPokeZMode(GXBool compare_enable, GXCompare func, GXBool update_enable);
18+
void GXPeekARGB(u16 x, u16 y, u32* color);
19+
void GXPokeARGB(u16 x, u16 y, u32 color);
20+
void GXPeekZ(u16 x, u16 y, u32* z);
21+
void GXPokeZ(u16 x, u16 y, u32 z);
22+
u32 GXCompressZ16(u32 z24, GXZFmt16 zfmt);
23+
u32 GXDecompressZ16(u32 z16, GXZFmt16 zfmt);
24+
25+
#ifdef __cplusplus
26+
}
27+
#endif
28+
29+
#endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef _DOLPHIN_GX_GXCULL_H_
2+
#define _DOLPHIN_GX_GXCULL_H_
3+
4+
#include <dolphin/gx/GXEnum.h>
5+
6+
#ifdef __cplusplus
7+
extern "C" {
8+
#endif
9+
10+
void GXSetScissor(u32 left, u32 top, u32 wd, u32 ht);
11+
void GXSetCullMode(GXCullMode mode);
12+
void GXSetCoPlanar(GXBool enable);
13+
14+
#ifdef __cplusplus
15+
}
16+
#endif
17+
18+
#endif
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#ifndef _DOLPHIN_GX_GXDISPLIST_H_
2+
#define _DOLPHIN_GX_GXDISPLIST_H_
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
void GXBeginDisplayList(void* list, u32 size);
9+
u32 GXEndDisplayList(void);
10+
void GXCallDisplayList(void* list, u32 nbytes);
11+
12+
#ifdef __cplusplus
13+
}
14+
#endif
15+
16+
#endif

0 commit comments

Comments
 (0)