Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TexMovie is evil #278

Merged
merged 1 commit into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config/SZBE69_B8/flags.json
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,13 @@
"-O4,p",
"-inline auto"
]
},
"sdk/RevoEX": {
"base": "base",
"flags": [
"-func_align 4",
"-O4,p"
]
}
}
}
13 changes: 9 additions & 4 deletions config/SZBE69_B8/objects.json
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,8 @@
"system/midi/MidiReceiver.cpp": "Matching",
"system/midi/MidiVarLen.cpp": "Matching",

"system/movie/TexMovie.cpp": "NonMatching",

"system/obj/DataArray.cpp": "NonMatching",
"system/obj/DataFile.cpp": "NonMatching",
"system/obj/DataFunc.cpp": "NonMatching",
Expand Down Expand Up @@ -673,6 +675,7 @@
"sdk/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/buffer_io.c": "NonMatching",
"sdk/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/errno.c": "Matching",
"sdk/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/float.c": "Matching",
"sdk/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/mem.c": "Matching",
"sdk/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/rand.c": "Matching",

"sdk/PowerPC_EABI_Support/MSL/MSL_C/PPC_EABI/time.dolphin.c": "Matching",
Expand Down Expand Up @@ -742,24 +745,26 @@
"mw_version": "Wii/1.3",
"cflags": "sdk/RVL_SDK",
"objects": {
"sdk/RVL_SDK/revolution/base/PPCArch.c": "Matching",

"sdk/RVL_SDK/revolution/gx/GXBump.c": "NonMatching",
"sdk/RVL_SDK/revolution/gx/GXDisplayList.c": "Matching",
"sdk/RVL_SDK/revolution/gx/GXGeometry.c": "Matching",
"sdk/RVL_SDK/revolution/gx/GXLight.c": "Matching",
"sdk/RVL_SDK/revolution/gx/GXTransform.c": "Matching",



"sdk/RVL_SDK/revolution/wpadDrm/WPADDrm.c": "Matching",
"sdk/RVL_SDK/revolution/wpadGtr/WPADGtr.c": "Matching"
}
},
"sdk/RevoEX": {
"mw_version": "Wii/1.3",
"cflags": "base",
"cflags": "sdk/RevoEX",
"objects": {
"sdk/RevoEX/so/SOCommon.c": "NonMatching",
"sdk/RevoEX/so/SOBasic.c": "NonMatching"
"sdk/RevoEX/so/SOBasic.c": "NonMatching",

"sdk/RevoEX/ssl/ssl_mutex.c": "NonMatching"
}
},
"sdk/DWC": {
Expand Down
64 changes: 64 additions & 0 deletions src/sdk/PowerPC_EABI_Support/MSL/MSL_C/MSL_Common/mem.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#include "types.h"
#include "mem_funcs.h"

void* memmove(void* dst, const void* src, size_t n) {
char* dst2 = dst; char* src2 = *(char**)&src;
uint r6 = (uint)dst ^ (uint)src;
uint r7 = ((uint)dst << __cntlzw(r6)) >> 31;
if (n >= 0x20) {
if (r6 & 3) {
if (r7 == 0) {
__copy_longs_unaligned(dst, src, n);
} else __copy_longs_rev_unaligned(dst, src, n);
} else {
if (r7 == 0) {
__copy_longs_aligned(dst, src, n);
} else __copy_longs_rev_aligned(dst, src, n);
}
return dst;
} else {
if (r7 == 0) {
src2--;
dst2--;
n++;
while (--n) *++dst2 = *++src2;
} else {
src2 += n;
dst2 += n;
n++;
while (--n) *--dst2 = *--src2;
}
return dst;
}
//while (n--) {}
}

void* memchr(const void* mem, int c, size_t n) {
u8 c2 = c;
char* m2 = *(char**)&mem - 1;
n++;
while (--n) if (*(u8*)(++m2) == c2) return m2;
return NULL;
}

void* __memrchr(const void* mem, uint c, size_t n) {
u8 c2 = c;
char* m2 = *(char**)&mem + n;
n++;
while (--n) if (*(u8*)(--m2) == c2) return m2;
return NULL;
}

int memcmp(const void* src1, const void* src2, size_t n) {
const u8 *p1;
const u8 *p2;

for (p1 = (const u8 *)src1 - 1, p2 = (const u8 *)src2 - 1, n++; --n;)
{
if (*++p1 != *++p2)
{
return (*p1 < *p2) ? -1 : 1;
}
}
return 0;
}
259 changes: 259 additions & 0 deletions src/sdk/RVL_SDK/revolution/base/PPCArch.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,259 @@
#include "revolution/BASE.h"
#include "revolution/OS.h"

asm u32 PPCMfmsr(void) {
nofralloc
mfmsr r3
blr
}

asm void PPCMtmsr(register u32 val) {
nofralloc
mtmsr val
blr
}


//unused
asm void PPCOrMsr(){
}

//unused
asm void PPCAndMsr(){
}

//unused
asm void PPCAndCMsr(){
}

asm u32 PPCMfhid0(void) {
nofralloc
mfhid0 r3
blr
}

asm void PPCMthid0(register u32 val) {
nofralloc
mthid0 val
blr
}

//unused
asm void PPCMfhid1(){
}

asm u32 PPCMfl2cr(void) {
nofralloc
mfl2cr r3
blr
}

asm void PPCMtl2cr(register u32 val) {
nofralloc
mtl2cr val
blr
}

asm void PPCMtdec(register u32 val) {
nofralloc
mtdec val
blr
}

//unused
asm void PPCMfdec(){
}

asm void PPCSync(void) {
nofralloc
sc
blr
}

//unused
asm void PPCEieio(){
}

asm void PPCHalt(void) {
nofralloc
sync

loop:
nop
li r3, 0
nop
b loop
}

//unused
asm void PPCMfmmcr0(){
}

asm void PPCMtmmcr0(register u32 val) {
nofralloc
mtmmcr0 val
blr
}

//unused
asm void PPCMfmmcr1(){
}

asm void PPCMtmmcr1(register u32 val) {
nofralloc
mtmmcr1 val
blr
}

//unused
asm void PPCMfpmc1(){
}

asm void PPCMtpmc1(register u32 val) {
nofralloc
mtpmc1 val
blr
}

//unused
asm void PPCMfpmc2(){
}

asm void PPCMtpmc2(register u32 val) {
nofralloc
mtpmc2 val
blr
}

//unused
asm void PPCMfpmc3(){
}

asm void PPCMtpmc3(register u32 val) {
nofralloc
mtpmc3 val
blr
}

//unused
asm void PPCMfpmc4(){
}

asm void PPCMtpmc4(register u32 val){
nofralloc
mtpmc4 val
blr
}

//unused
asm void PPCMfsia(){
}

//unused
asm void PPCMtsia(){
}

u32 PPCMffpscr(void) {
register u64 fpscr;

asm {
mffs f31
stfd f31, fpscr
}

return fpscr;
}

void PPCMtfpscr(register u32 val) {
register struct {
float tmp;
float data;
} fpscr;

asm {
li r4, 0
stw r4, fpscr.tmp
stw val, fpscr.data
lfd f31, fpscr.tmp
mtfs f31
}
}

asm u32 PPCMfhid2(void) {
nofralloc
mfspr r3, 0x398 //HID2
blr
}

asm void PPCMthid2(register u32 val) {
nofralloc
mtspr 0x398, val //HID2
blr
}

asm u32 PPCMfwpar(void) {
nofralloc
sync
mfwpar r3
blr
}

asm void PPCMtwpar(register u32 val) {
nofralloc
mtwpar r3
blr
}

//unused
asm void PPCMfdmaU(){
}

//unused
asm void PPCMfdmaL(){
}

//unused
asm void PPCMtdmaU(){
}

//unused
asm void PPCMtdmaL(){
}

//unused
asm void PPCMfpvr(){
}

//unused
void PPCEnableSpeculation(){
}

void PPCDisableSpeculation(void) { PPCMthid0(PPCMfhid0() | HID0_SPD); }

//unused
asm void PPCSetFpIEEEMode(){
}

asm void PPCSetFpNonIEEEMode(void) {
nofralloc
mtfsb1 29
blr
}

//unused
void PPCMfhid4(){
}

void PPCMthid4(register u32 val) {
if (val & HID4_H4A) {
asm {
mtspr 0x3F3, val //HID4
}
} else {
OSReport("H4A should not be cleared because of Broadway errata.\n");
val |= HID4_H4A;
asm {
mtspr 0x3F3, val //HID4
}
}
}
11 changes: 11 additions & 0 deletions src/sdk/RevoEX/ssl/ssl_mutex.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "revolution/OS.h"

void SSL_InitMutex(OSMutex* mutex) {
OSInitMutex(mutex);
}
void SSL_LockMutex(OSMutex* mutex) {
OSLockMutex(mutex);
}
void SSL_UnlockMutex(OSMutex* mutex) {
OSUnlockMutex(mutex);
}
Loading
Loading