Giter VIP home page Giter VIP logo

fray's People

Contributors

filiphsps avatar magcius avatar psilupan avatar wcarter-connect avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fray's Issues

DVD Handles Not Closed

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.

Rewrite CObj struct to use unions

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;

DVD*ToEntrynum Speedups

  1. Build lookup table of directories on boot and the store the length of that table.
  2. Make the lookup an interpolation search
    https://en.wikipedia.org/wiki/Interpolation_search

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.

Add README

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)

No XFB Update After Frame 1

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.

HSD_CObj: setupNormalCamera Scissor Issue

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:

//FIXME: The following is commented out, because the FIFO log showed the registers for SCISSORRB was wildly off

HSD_TExpSetReg Assertion

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.

JObjLoadJoint Crash

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.

Add CodeWarrior Branch

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.

  • Fix DVD loading. Currently cannot find GmTitle.usd with the library DVDFastOpen, and my custom version causes an alignment issue.
  • Figure out optimization settings. Can test a known matching function, such as TObj's functions.

Project Goals

What does building this project produce? (I assume a GameCube iso)

What are the goals of this project?

How can I help?

Workaround LiboGC's lack of GX_GetViewport

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;
}

FIFO No Longer Being Updated

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.

GObj_SetupGXLink Priority Issue

A priority higher than 0 seems to cause the function to never fire.

Visible in scGmTitle's JObj_SetupInstanceMtx_Callback

Move Clang to Master branch

Given that Clang compiles correctly and produces a smaller binary, should move it to the Master branch to replace GCC.

  • Setup instructions for using Clang over GCC
  • Make makefile more generic for Clang support. Currently relies on setting the CC var relative to what Clang is setup as.
  • Adjust the build process. Maybe switch to GitHub actions over Travis?

HSD_VISetXFBDrawDone Crash

if (match_controller.screen_ctrl != 0) {

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.

Fix CObj Scissors

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];

Title Background Not Masked Properly

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.

Black Screen Render

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.

Does Not Work on Console

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).

TExp Asserts

TExp asserts on c_dst and a_dst is undefined regularly, though the TEV appears to work properly now.

1 Frame Draw Then Crash

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.

TExp SimplifySrc Incorrect

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.

TExp2TevDesc Crash

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.

if (tev->c_in[k].type == HSD_TE_TEV) {

This likely means that HSD_TExpSimplify is functioning incorrectly.

Tev Rendering Issues

When the Title renders, there's some alpha issues occurring.

  1. No text is visible.
  2. The FIFO indicates there's some TEV register changes not occurring and the tevstage is off by 1. However, because LiboGC has it's own bug fix, it's possible it was used similarly to flush the gather pipe.

When Alpha is changed in HSD_TExpSetReg, you can make some elements appear. However, the function appears to be correct. The only exception is

*(u32*)&reg[texp->cnst.reg] = (*(u32*)(texp->cnst.val) & 0xFFFFFF00) | (u32)reg[texp->cnst.reg].a;
and the difference there is the Alpha channel relies on garbage data, IE. it will retrieve the last 8 bits of a pointer from the stack.

I believe the Merge functions are correct now after multiple tests, so unsure of possible cause.

HSD_ObjAlloc returns NULL

ObjAlloc appears to return NULL. It follows the free == 0 codepath, which is accurate, but it seems ObjAllocAddFree may be at issue.

Title Fire Wrong Layer

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.

Test Process

  • Extract DVD Filesystem with Dolphin to a directory
  • Running make will produce a main.dol and main.elf
  • Rename the original main.dol from the game and place the new one in the directory
  • Set your default ISO as your copy of Melee (Either the one in this directory, or the original. This makes Dolphin think it's in the DVD drive.)

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.

LObjSetupInit Crash

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.

Title Alpha Issues

  • Melee should be highlighted. The secondary object that acts as the highlight has a 0 alpha.
  • The top and bottom gray bars are missing.

FST Not Loaded Currently

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.