psilupan / fray Goto Github PK
View Code? Open in Web Editor NEWRecompilable version of Super Smash Bros. Melee 1.02 based on the LibOGC project.
License: The Unlicense
Recompilable version of Super Smash Bros. Melee 1.02 based on the LibOGC project.
License: The Unlicense
Reminded by Altimor that I hadn't done this. LibOGC doesn't have DVDCancel, so hopefully the CancelAll will work as expected. Will just have to deal with having a callback, since it's an async function.
The current version of CObj simply assumes offset 0x2C-0x34 and 0x40 - 0x4C are all the same variables, but it's actually a union to allow for the variables to have distinguishing names.
Below is 0x2C-0x34:
union {
f32 roll;
guVector up;
} u;
Below is the contents of 0x40 - 0x4C:
union {
struct {
f32 top;
f32 bottom;
f32 left;
f32 right;
} frustrum;
struct {
f32 top;
f32 bottom;
f32 left;
f32 right;
} ortho;
struct {
f32 fov;
f32 aspect;
} perspective;
} projection_param;
IE.
If Filename has >1 tokens, keep the previous token as it will be the parent directory with the closest entrynum. Look it up in the table, which should be a handful of values in Vanilla, then use that entrynum+1 as the starting index of the array.
Use the next directory entrynum as the end index, if the table entry is less than the total size. Otherwise, use total_entries.
Then, perform a binary search. The first char of the given filename and the current entry filename can be compared to simplify the search, as I believe the FST is alphabetical within a given directory.
Please add a README, see #3 for questions it should answer.
Also should explain the name - as it's cryptic (for non-native-speakers) and makes this project hard to find.
(And while you don't use it, please disable GitHub "Projects" and GitHub "Wiki" - those links do nothing for users and are just confusing)
After the first frame of the Title renders, the remaining frames contain no data/bad data. The result is blank frames, save for the grey background.
Based on Dolphin's FIFO log, the math was wildly off for the scissor, resulting in an entirely black screen, rather than the slight gray normally in the background of the menu.
I've hardcoded the appropriate results for now:
Line 193 in 2e0f470
On the 3rd iteration, the TExp is a TEV instead of a CNST type. This results in the assert failing (Currently a Halt, because GCC was making some assembly that broke the extremely basic logic for some reason).
Causing it to continue if there type != 4 leads to a later FIFO error, but presumably related to the above.
On Clang builds, JObjLoadJoint will walk a valid JObj tree and eventually get to about 3 calls left on the stack after about 31 prior calls when it appears that the JObjDesc is a pointer to some non-JObjDesc data.
The result is that the RObjLoadDesc call receives a floating point value instead of a pointer to the RObj.
Have FRAY compiling locally with CodeWarrior. Would like to make a branch for it that likely won't go maintained, outside of using it to test for matching assembly/performing a compiler attack on confusing functions.
What does building this project produce? (I assume a GameCube iso)
What are the goals of this project?
How can I help?
Since LiboGC is essentially dead, as far as closing/dealing with PRs goes, we need to calculate viewport pixel state and store it somewhere each call to GX_SetViewport. This is necessary for Fog calculations.
This may be best accomplished with a wrapper around the original function, such as the following:
I do need to validate SetViewport as GetViewport says it returns the normalized values for near/far, but it appears that it didn't actually do that in code. It seems everything was post-math stored, rather than storing the untouched parameters of SetViewport.
static struct _GXViewport {
f32 x0,y0,x1,y1,n,f,z;
} GXViewport;
void GX_SetViewport_Wrapper(f32 xOrig, f32 yOrig, f32 wd,f32 ht, f32 nearZ ,f32 farZ)
{
static const f32 Xfactor = 0.5f;
static const f32 Yfactor = 342.0f;
static const f32 Zfactor = 16777215.0f;
GXViewport.x0 = wd * Xfactor;
GXViewport.y0 = (-ht) * Xfactor;
GXViewport.x1 = (xOrig + (wd * Xfactor)) + Yfactor;
GXViewport.y1 = (yOrig + (ht*Xfactor)) + Yfactor;
GXViewport.n = nearZ;
GXViewport.f = farZ;
GXViewport.z = (Zfactor * GXViewport.f) - (ZFactor * GXViewport.n);
GX_SetViewport(xOrig, yOrig, wd, ht, nearZ, farZ);
}
void GX_GetViewport(f32* xOrig,f32* yOrig,f32* wd,f32* ht,f32* nearZ,f32* farZ)
{
*xOrig = GXViewport.x0;
*yOrig = GXViewport.y0;
*wd = GXViewport.x1;
*ht = GXViewport.y1;
*nearZ = GXViewport.n;
*farZ = GXViewport.f;
}
Video changes in 2e46b4c have caused the FIFO to stop updating with objects. Each frame now contains actual data in the first object of the pipe, which is obviously correct, but it's no longer pushing BP, etc. registers to actually update the pipe.
This is likely another case of a bug with XFB copies or a bug with GX procs is manifesting.
Currently stubbed to deal with undefined refs. Need to complete the sub functions that do the meat of the work.
A priority higher than 0 seems to cause the function to never fire.
Visible in scGmTitle's JObj_SetupInstanceMtx_Callback
Given that Clang compiles correctly and produces a smaller binary, should move it to the Master branch to replace GCC.
Title is rendered, but the rotation animations do not occur.
Line 811 in 2e46b4c
Crash is triggering when SetXFBDrawDone is called. screen_ctrl shouldn't be changing, so a write breakpoint should catch the cause.
This is occurring on both Clang and GCC.
Line 1044 in 2233e93
"5" wouldn't technically work with the current TExpRef implementation. So either the "sel" needs to be checked against "!= 0" or the call is wrong.
Per Altimor:
CObj_Create and CObjLoad in FRAY handle scissors incorrectly
cobj->scissor_left = desc->scissor_lr;
cobj->scissor_top = desc->scissor_tb;
in CObjLoad should be
cobj->scissor_left = desc->scissor_lr >> 16;
cobj->scissor_right = desc->scissor_lr & 0xFFFF;
cobj->scissor_top = desc->scissor_tb >> 16;
cobj->scissor_bottom = desc->scissor_tb & 0xFFFF;
and
scissors[0] = 640;
scissors[2] = 480;
in CObj_Create should be
scissors[1] = scissors[1] > 640 ? 640 : scissors[1];
scissors[3] = scissors[3] > 480 ? 480 : scissors[3];
The background has a rounded cone-like object that rotates with 2 different colors. These are supposed to be masked to look like sparkles and currently the full line is rendered.
Game is now looping and rendering on a black screen.
Dolphin shader compilation shows several errors of:
50:42:857 videobackends\d3dcommon\shader.cpp:125 W[Video]: ps_5_0 compilation succeeded with warnings: D:\Dolphin-EMU\Shader@0x00000196AB392EE0(659,7): warning X4000: use of potentially uninitialized variable (alpha_A) D:\Dolphin-EMU\Shader@0x00000196AB392EE0(659,7): warning X4000: use of potentially uninitialized variable (alpha_B) 50:43:253 videobackends\d3dcommon\shader.cpp:125 W[Video]: ps_5_0 compilation succeeded with warnings: D:\Dolphin-EMU\Shader@0x00000196AB392EE0(657,7): warning X4000: use of potentially uninitialized variable (alpha_A) D:\Dolphin-EMU\Shader@0x00000196AB392EE0(657,7): warning X4000: use of potentially uninitialized variable (alpha_B) 50:43:656 videobackends\d3dcommon\shader.cpp:125 W[Video]: ps_5_0 compilation succeeded with warnings: D:\Dolphin-EMU\Shader@0x00000196AB392EE0(658,7): warning X4000: use of potentially uninitialized variable (alpha_A) D:\Dolphin-EMU\Shader@0x00000196AB392EE0(658,7): warning X4000: use of potentially uninitialized variable (alpha_B) 50:44:059 videobackends\d3dcommon\shader.cpp:125 W[Video]: ps_5_0 compilation succeeded with warnings: D:\Dolphin-EMU\Shader@0x00000196A8712A80(658,7): warning X4000: use of potentially uninitialized variable (alpha_A) D:\Dolphin-EMU\Shader@0x00000196A8712A80(658,7): warning X4000: use of potentially uninitialized variable (alpha_B)
So possibly due to a missing part of HSD_State or something else.
Using both extracted FST and a custom DOL, the game boots and remains on a black screen.
It's entirely possible at this time that I need to flush the data cache for the FST related stuff. It would explain why it's working on Dolphin and not Nintendont (and likely Swiss / console in general).
Line 129 in 3111462
During debug, it's returning for example "4," which hsdAllocMemPiece tries to dereference and causes an exception.
TExp asserts on c_dst and a_dst is undefined regularly, though the TEV appears to work properly now.
Currently, the latest GCC build will display the image for one frame before dropping into the idle loop forever.
Cause is currently unknown, as there's no exception handler call. Suspect that it may be bad data on the FIFO, eventually resulting in a FIFO reset that throws it into the loop.
Commented out, more textures begin to show. Likely producing an incorrect result.
Given this just prevents tev bloat, and the other simplify functions seem to reduce the size by half as is, likely non-issue for now.
HSD_TExpMakeDag currently attempts to test the type on the first for loop, and on the final iteration the TExp appears to not be allocated and will lead to a bad deref.
Line 951 in 389c858
This likely means that HSD_TExpSimplify is functioning incorrectly.
When the Title renders, there's some alpha issues occurring.
When Alpha is changed in HSD_TExpSetReg, you can make some elements appear. However, the function appears to be correct. The only exception is
Line 1207 in cd4d5c5
I believe the Merge functions are correct now after multiple tests, so unsure of possible cause.
Fix uses of pointer math relying on 32-bit sized pointers to use appropriate types and casts for pointers.
This will make support of a 64-bit compilation easier in the future.
Line 181 in f75476f
Around this line, the function doesn't match the original game and will end up returning a bad value. Ghidra decompilation appeared to be off.
ObjAlloc appears to return NULL. It follows the free == 0 codepath, which is accurate, but it seems ObjAllocAddFree may be at issue.
If the TObjUpdateFunc occurs to set the current image in the image table, the fire animation occurs on top of the text. This function is not the cause, even if the float to s32 cast occurs.
This is because the HAL developer that wrote it forgot FObjData had an s32 in the union. Fixing it would require other changes and is not relevant to the layering issue.
Handles something related to scene speed
That will trick Dolphin into running the Apploader and setting the GAME ID as GALE01, etc..
You can also boot with the ELF and it will automatically provide Dolphin with debug symbols, but it won't use the Apploader. Only really good for debugging in the interim.
One of the inlined init functions in the switch cases gets a non-pointer value from LObj's lightobj. Attempting to dereference it to check the flags causes an exception.
I've tried booting with the DOL replacing the original Melee one, and it appears the Apploader doesn't handle loading the FST.bin file. I believe there is a modern version of GeckoOS with an example of using LiboGC to load the FST.
The other issue is that DVD_Mount() appeared to cause an exception, but that may be because SYS_INIT occurring prior. Will also need to check that as well.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.