Fixes by encounter
This commit is contained in:
parent
1bb770e5d7
commit
07b827eb2d
9 changed files with 509 additions and 491 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,77 +1,92 @@
|
|||
#include "dolphin/mtx.h"
|
||||
#include "dolphin/gx/GXPriv.h"
|
||||
#include "math.h"
|
||||
|
||||
void C_MTXFrustum(Mtx44 m, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6)
|
||||
{
|
||||
f32 tmp = 1.0f / (arg4 - arg3);
|
||||
m[0][0] = (2 * arg5) * tmp;
|
||||
m[0][1] = 0.0f;
|
||||
m[0][2] = (arg4 + arg3) * tmp;
|
||||
m[0][3] = 0.0f;
|
||||
tmp = 1.0f / (arg1 - arg2);
|
||||
m[1][0] = 0.0f;
|
||||
m[1][1] = (2 * arg5) * tmp;
|
||||
m[1][2] = (arg1 + arg2) * tmp;
|
||||
m[1][3] = 0.0f;
|
||||
m[2][0] = 0.0f;
|
||||
m[2][1] = 0.0f;
|
||||
tmp = 1.0f / (arg6 - arg5);
|
||||
m[2][2] = -(arg5)*tmp;
|
||||
m[2][3] = -(arg6 * arg5) * tmp;
|
||||
m[3][0] = 0.0f;
|
||||
m[3][1] = 0.0f;
|
||||
m[3][2] = -1.0f;
|
||||
m[3][3] = 0.0f;
|
||||
void C_MTXFrustum(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f) {
|
||||
f32 tmp;
|
||||
|
||||
ASSERTMSGLINE(105, m, "MTXFrustum(): NULL Mtx44Ptr 'm' ");
|
||||
ASSERTMSGLINE(106, t != b, "MTXFrustum(): 't' and 'b' clipping planes are equal ");
|
||||
ASSERTMSGLINE(107, l != r, "MTXFrustum(): 'l' and 'r' clipping planes are equal ");
|
||||
ASSERTMSGLINE(108, n != f, "MTXFrustum(): 'n' and 'f' clipping planes are equal ");
|
||||
tmp = 1 / (r - l);
|
||||
m[0][0] = (2 * n * tmp);
|
||||
m[0][1] = 0;
|
||||
m[0][2] = (tmp * (r + l));
|
||||
m[0][3] = 0;
|
||||
tmp = 1 / (t - b);
|
||||
m[1][0] = 0;
|
||||
m[1][1] = (2 * n * tmp);
|
||||
m[1][2] = (tmp * (t + b));
|
||||
m[1][3] = 0;
|
||||
m[2][0] = 0;
|
||||
m[2][1] = 0;
|
||||
tmp = 1 / (f - n);
|
||||
m[2][2] = (-n * tmp);
|
||||
m[2][3] = (tmp * -(f * n));
|
||||
m[3][0] = 0;
|
||||
m[3][1] = 0;
|
||||
m[3][2] = -1;
|
||||
m[3][3] = 0;
|
||||
}
|
||||
|
||||
// Functions match but has issues with float constants
|
||||
void C_MTXPerspective(Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f)
|
||||
{
|
||||
f32 angle = fovY * 0.5f;
|
||||
void C_MTXPerspective(Mtx44 m, f32 fovY, f32 aspect, f32 n, f32 f) {
|
||||
f32 angle;
|
||||
f32 cot;
|
||||
f32 tmp;
|
||||
|
||||
ASSERTMSGLINE(179, m, "MTXPerspective(): NULL Mtx44Ptr 'm' ");
|
||||
ASSERTMSGLINE(180, (fovY > 0.0) && (fovY < 180.0), "MTXPerspective(): 'fovY' out of range ");
|
||||
ASSERTMSGLINE(181, 0.0f != aspect, "MTXPerspective(): 'aspect' is 0 ");
|
||||
|
||||
angle = (0.5f * fovY);
|
||||
angle = MTXDegToRad(angle);
|
||||
cot = 1.0f / tanf(angle);
|
||||
m[0][0] = cot / aspect;
|
||||
m[0][1] = 0.0f;
|
||||
m[0][2] = 0.0f;
|
||||
m[0][3] = 0.0f;
|
||||
m[1][0] = 0.0f;
|
||||
m[1][1] = cot;
|
||||
m[1][2] = 0.0f;
|
||||
m[1][3] = 0.0f;
|
||||
m[2][0] = 0.0f;
|
||||
m[2][1] = 0.0f;
|
||||
tmp = 1.0f / (f - n);
|
||||
m[2][2] = -(n)*tmp;
|
||||
m[2][3] = -(f * n) * tmp;
|
||||
m[3][0] = 0.0f;
|
||||
m[3][1] = 0.0f;
|
||||
m[3][2] = -1.0f;
|
||||
m[3][3] = 0.0f;
|
||||
cot = 1 / tanf(angle);
|
||||
m[0][0] = (cot / aspect);
|
||||
m[0][1] = 0;
|
||||
m[0][2] = 0;
|
||||
m[0][3] = 0;
|
||||
m[1][0] = 0;
|
||||
m[1][1] = (cot);
|
||||
m[1][2] = 0;
|
||||
m[1][3] = 0;
|
||||
m[2][0] = 0;
|
||||
m[2][1] = 0;
|
||||
tmp = 1 / (f - n);
|
||||
m[2][2] = (-n * tmp);
|
||||
m[2][3] = (tmp * -(f * n));
|
||||
m[3][0] = 0;
|
||||
m[3][1] = 0;
|
||||
m[3][2] = -1;
|
||||
m[3][3] = 0;
|
||||
}
|
||||
|
||||
void C_MTXOrtho(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f)
|
||||
{
|
||||
f32 tmp = 1.0f / (r - l);
|
||||
m[0][0] = 2.0f * tmp;
|
||||
m[0][1] = 0.0f;
|
||||
m[0][2] = 0.0f;
|
||||
m[0][3] = -(r + l) * tmp;
|
||||
tmp = 1.0f / (t - b);
|
||||
m[1][0] = 0.0f;
|
||||
m[1][1] = 2.0f * tmp;
|
||||
m[1][2] = 0.0f;
|
||||
m[1][3] = -(t + b) * tmp;
|
||||
m[2][0] = 0.0f;
|
||||
m[2][1] = 0.0f;
|
||||
tmp = 1.0f / (f - n);
|
||||
m[2][2] = -(1.0f) * tmp;
|
||||
m[2][3] = -(f)*tmp;
|
||||
m[3][0] = 0.0f;
|
||||
m[3][1] = 0.0f;
|
||||
m[3][2] = 0.0f;
|
||||
m[3][3] = 1.0f;
|
||||
void C_MTXOrtho(Mtx44 m, f32 t, f32 b, f32 l, f32 r, f32 n, f32 f) {
|
||||
f32 tmp;
|
||||
|
||||
ASSERTMSGLINE(254, m, "MTXOrtho(): NULL Mtx44Ptr 'm' ");
|
||||
ASSERTMSGLINE(255, t != b, "MTXOrtho(): 't' and 'b' clipping planes are equal ");
|
||||
ASSERTMSGLINE(256, l != r, "MTXOrtho(): 'l' and 'r' clipping planes are equal ");
|
||||
ASSERTMSGLINE(257, n != f, "MTXOrtho(): 'n' and 'f' clipping planes are equal ");
|
||||
tmp = 1 / (r - l);
|
||||
m[0][0] = 2 * tmp;
|
||||
m[0][1] = 0;
|
||||
m[0][2] = 0;
|
||||
m[0][3] = (tmp * -(r + l));
|
||||
tmp = 1 / (t - b);
|
||||
m[1][0] = 0;
|
||||
m[1][1] = 2 * tmp;
|
||||
m[1][2] = 0;
|
||||
m[1][3] = (tmp * -(t + b));
|
||||
m[2][0] = 0;
|
||||
m[2][1] = 0;
|
||||
tmp = 1 / (f - n);
|
||||
m[2][2] = (-1 * tmp);
|
||||
m[2][3] = (-f * tmp);
|
||||
m[3][0] = 0;
|
||||
m[3][1] = 0;
|
||||
m[3][2] = 0;
|
||||
m[3][3] = 1;
|
||||
}
|
||||
|
||||
#ifdef GEKKO
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ SHARED_SYM s32 SystemInitF;
|
|||
|
||||
#ifdef TARGET_PC
|
||||
#include <stdio.h>
|
||||
void aurora_log_callback(AuroraLogLevel level, const char *message, unsigned int len)
|
||||
void aurora_log_callback(AuroraLogLevel level, const char* module, const char *message, unsigned int len)
|
||||
{
|
||||
const char *levelStr = "??";
|
||||
FILE *out = stdout;
|
||||
|
|
@ -73,14 +73,12 @@ void aurora_log_callback(AuroraLogLevel level, const char *message, unsigned int
|
|||
out = stderr;
|
||||
break;
|
||||
}
|
||||
fprintf(out, "[%s: %s]\n", levelStr, message);
|
||||
fprintf(out, "[%s | %s] %s\n", levelStr, module, message);
|
||||
if (level == LOG_FATAL) {
|
||||
fflush(out);
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
||||
void VICallPostRetraceCallback(s32 retraceCount);
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_PC
|
||||
|
|
@ -94,6 +92,11 @@ void main(void)
|
|||
&(AuroraConfig) {
|
||||
.appName = "Mario Party 4",
|
||||
.logCallback = &aurora_log_callback,
|
||||
.desiredBackend = BACKEND_VULKAN,
|
||||
.windowPosX = 100,
|
||||
.windowPosY = 100,
|
||||
.windowWidth = 640,
|
||||
.windowHeight = 480,
|
||||
});
|
||||
#endif
|
||||
u32 met0;
|
||||
|
|
@ -186,7 +189,6 @@ void main(void)
|
|||
|
||||
msmMusFdoutEnd();
|
||||
HuSysDoneRender(retrace);
|
||||
|
||||
GXReadGPMetric(&met0, &met1);
|
||||
GXReadVCacheMetric(&vcheck, &vmiss, &vstall);
|
||||
GXReadPixMetric(&top_pixels_in, &top_pixels_out, &bot_pixels_in, &bot_pixels_out, &clr_pixels_in, &total_copy_clks);
|
||||
|
|
@ -197,8 +199,6 @@ void main(void)
|
|||
#ifdef TARGET_PC
|
||||
imgui_main(&auroraInfo);
|
||||
aurora_end_frame();
|
||||
// TODO PC remove
|
||||
VICallPostRetraceCallback(0);
|
||||
frame_limiter();
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,9 +142,9 @@ void imgui_main(const AuroraInfo *info)
|
|||
hasPrevious = true;
|
||||
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Queued pipelines: {}\n"), aurora::gfx::queuedPipelines));
|
||||
fmt::format(FMT_STRING("Queued pipelines: {}\n"), aurora::gfx::queuedPipelines.load()));
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Done pipelines: {}\n"), aurora::gfx::createdPipelines));
|
||||
fmt::format(FMT_STRING("Done pipelines: {}\n"), aurora::gfx::createdPipelines.load()));
|
||||
ImGuiStringViewText(
|
||||
fmt::format(FMT_STRING("Draw call count: {}\n"), aurora::gfx::g_drawCallCount));
|
||||
ImGuiStringViewText(fmt::format(FMT_STRING("Merged draw calls: {}\n"),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
#include "dolphin/gx/GXVert.h"
|
||||
#include "dolphin/vitypes.h"
|
||||
#include <dolphin.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -10,6 +9,8 @@
|
|||
|
||||
// Credits: Super Monkey Ball
|
||||
|
||||
static VIRetraceCallback sVIRetraceCallback = NULL;
|
||||
|
||||
void OSReport(const char *msg, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
|
@ -475,7 +476,10 @@ void VISetNextFrameBuffer(void *fb)
|
|||
|
||||
void VIWaitForRetrace()
|
||||
{
|
||||
// puts("VIWaitForRetrace is a stub");
|
||||
if (sVIRetraceCallback)
|
||||
{
|
||||
sVIRetraceCallback(0);
|
||||
}
|
||||
}
|
||||
|
||||
s32 __CARDFormatRegionAsync(int a, int b)
|
||||
|
|
@ -528,18 +532,10 @@ void SISetSamplingRate(u32 msec)
|
|||
puts("SISetSamplingRate is a stub");
|
||||
}
|
||||
|
||||
VIRetraceCallback postRetraceCallback = NULL;
|
||||
|
||||
VIRetraceCallback VISetPostRetraceCallback(VIRetraceCallback callback)
|
||||
{
|
||||
postRetraceCallback = callback;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void VICallPostRetraceCallback(s32 retraceCount)
|
||||
{
|
||||
if (postRetraceCallback != NULL)
|
||||
postRetraceCallback(retraceCount);
|
||||
sVIRetraceCallback = callback;
|
||||
return callback;
|
||||
}
|
||||
|
||||
void GXSetGPMetric(GXPerf0 perf0, GXPerf1 perf1)
|
||||
|
|
@ -610,57 +606,11 @@ void PPCSync(void)
|
|||
puts("PPCSync is a stub");
|
||||
}
|
||||
|
||||
void GXColor3u8(u8 r, u8 g, u8 b)
|
||||
{
|
||||
// TODO
|
||||
GXColor4u8(r, g, b, 255);
|
||||
}
|
||||
|
||||
void GXNormal1x16(u16 index)
|
||||
{
|
||||
puts("GXNormal1x16 is a stub");
|
||||
}
|
||||
|
||||
void GXColor1x16(u16 index)
|
||||
{
|
||||
puts("GXColor1x16 is a stub");
|
||||
}
|
||||
|
||||
void GXTexCoord1x16(u16 index)
|
||||
{
|
||||
puts("GXTexCoord1x16 is a stub");
|
||||
}
|
||||
|
||||
void GXUnknownu16(const u16 x)
|
||||
{
|
||||
puts("GXUnknownu16 is a stub");
|
||||
}
|
||||
|
||||
void GXNormal3s16(s16 x, s16 y, s16 z)
|
||||
{
|
||||
puts("GXNormal3s16 is a stub");
|
||||
}
|
||||
|
||||
void GXPosition2u16(const u16 x, const u16 y)
|
||||
{
|
||||
GXPosition3f32(x, y, 0);
|
||||
}
|
||||
|
||||
void GXPosition2f32(const f32 x, const f32 y)
|
||||
{
|
||||
GXPosition3f32(x, y, 0);
|
||||
}
|
||||
|
||||
void GXPosition2s16(const s16 x, const s16 y)
|
||||
{
|
||||
GXPosition3f32(x, y, 0);
|
||||
}
|
||||
|
||||
void GXColor1x8(u8 index)
|
||||
{
|
||||
puts("GXColor1x8 is a stub");
|
||||
}
|
||||
|
||||
void GXWaitDrawDone(void)
|
||||
{
|
||||
puts("GXWaitDrawDone is a stub");
|
||||
|
|
@ -682,8 +632,7 @@ void GXResetWriteGatherPipe(void)
|
|||
puts("GXResetWriteGatherPipe is a stub");
|
||||
}
|
||||
|
||||
void ARQInit(void)
|
||||
{
|
||||
void ARQInit(void) {
|
||||
puts("ARQInit is a stub");
|
||||
}
|
||||
|
||||
|
|
@ -692,13 +641,16 @@ void HuDvdErrDispInit(GXRenderModeObj *rmode, void *xfb1, void *xfb2) { }
|
|||
|
||||
void msmSysRegularProc(void)
|
||||
{
|
||||
puts("msmSysRegularProc is a stub");
|
||||
}
|
||||
|
||||
void msmMusFdoutEnd(void) { }
|
||||
void msmMusFdoutEnd(void)
|
||||
{
|
||||
}
|
||||
|
||||
s32 HuSoftResetButtonCheck(void)
|
||||
{
|
||||
// puts("HuSoftResetButtonCheck is a stub");
|
||||
//puts("HuSoftResetButtonCheck is a stub");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue