Code Monkey home page Code Monkey logo

sm64-port's People

Contributors

ahouts avatar bramhaag avatar jan200101 avatar matt-kempster avatar mkst avatar mountainflaw avatar retrogamer02 avatar ryotoko avatar thearst3rd avatar vaguerant avatar wyatt-james 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sm64-port's Issues

BUG Alpha blending on hard edge textures

Tracking this separately, as it's different than the fog problem.

93632751-b7afee80-f9a2-11ea-93a1-15639486d05f
As you can see in this image, the outline of the tree is clipping tris with other alpha functions: the tree's shadow, and other trees. Strangely, the tree on the right is not being clipped, but the tree on the left is.

Edit:
The problem is that the 3DS does not have a fragment shader or a programmable pixel shader, which is where true depth and alpha tests usually operate. The 3DS implements these at the last stage of the vertex shading pipeline and simulates them, and a depth and alpha test can only be applied once per frame. (This is one way the code might be cleaned up slightly, since Gericom added a lot of depth and alpha test calls apparently assuming the 3DS had fragment shading capabilities when it doesn't.)

As it stands, the texture filter is filtering the textures, which interpolates not only the color values but alpha values as well, and the result is a semi-transparency on the edge. You can cull all alpha values below 255 but you will lose the smoothed edge effect (and part of the texture). Any alpha values not culled will be the testing point of the depth test, which is next in the pipe, and considers the remaining alpha values as solid and culls what's behind them.

The reason that it only happens sometimes has to do with the draw order. The depth test only culls textures that fail the depth test. If the tree was properly drawn in front of a tree that it should be in front of, it is actually not culled and then proper blending occurs, which can be seen by disabling the depth mask.

As changing the depth test and alpha test values will adversely affect something else, the solution here needs to be fairly creative. I've come up with the following:

  • Disable the depth mask and create a render queue that first sorts the Z value of the closest vertex, for alpha textures, before sending them to the pipe, drawing them in their proper order and eliminating the need for the depth mask
  • Create a custom linear filter function for alpha textures that sets a hard gradient for alpha levels, setting all above a certain line to 255 and all below to 0, eliminating the semi-transparency. Depending on where filtering happens, this could be difficult or computationally expensive
  • Create "HD" textures for the problem textures (pretty much just trees) that are pre-filtered and have no semi-transparency, and flag them so the renderer knows not to filter them again

3D - Stereoscopic 3D Support

Introduction

This issue has been created to track the progress of adding stereoscopic 3D to the 3ds-port.

image

Progress:

3D is applied via applying Mtx_PerspStereoTilt to the projection applied in the vertex shader. Not everything should have this effect, otherwise 2d things with high (low?) Z-index pop out and poke your eyes.

The current approach to determining 2D is based on an extra call to 'set 2d mode' at specific points in the SM64 code. We also check that we are drawing something with 2 triangles; both of these conditions have to be met for the item not to be drawn in 3D.

3D

Apply 3D effect to everything in the 3D space.

  • Rudimentary 3D using Mtx_PerspStereoTilt from citro3d
  • Snow effect (potentially others)
  • Adjust focal length based on distance between mario+camera
  • Skybox

2D

We need to work out what is 2D and ensure we are not applying a 3D effect to that.

  • HUD (src/game/hud.c)
  • PAUSE screen ('src/game/print.c')
  • Signposts ('src/game/print.c')
  • Star select screen (src/menu/star_select.c)
  • Peach letter (src/game/ingame_menu.c)
  • Cannon overlay
  • Level/Area transitions
  • File select screen; it would be nice if whole screen was treated as 2D
  • TM and (C) Nintendo on first intro screen
  • Goddard background (somewhat fixed on 3ds-minimap branch)
  • Cutscene captions during ending are missing ("mario!")
  • more items TBD

Extra

  • Determine why an FOV is 54.0f rather than 45.0f is required to maintain same similar perspective to 2D mode; can we apply some viewport shifting?
  • Determine why extra args need to be set in perspective matrix in order to render anything
  • Apply scissoring to viewport for left/right eye after perspective applied (depends how strong 3D effect is)

Notes:

  • Setting POV to 90 shows that the STEREO button and Goddard moustache are being rendered with higher Z level than everything else, so presumably are being clipped... why?

Addendum:

The closed-source port by borb is simply doing:

    glMatrixMode(GL_PROJECTION);
    glLoadMatrixf(&(*gsp_mtxf_projection)[0][0]);
    glTranslatef(gsp_depth, 0.0F, 0.0F);

BUG - Jolly Roger Bay Walls alpha

The tops of the walls should be transparent.

3DS:
image

N64:
TODO

"It's an alphacompare" - Fazana.

More info to be added as it's discovered.

Edit 1

Increasing the threshold for alpha affects this:

    if (cc_features.opt_texture_edge && cc_features.opt_alpha)
        C3D_AlphaTest(true, GPU_GREATER, 77); // screenshot below is with this set to 200
    else
        C3D_AlphaTest(true, GPU_GREATER, 0);

image

30 fps pleas

how about 30fps?

game slows down a lot

audio cripples

and the game feels empty

pls also add an instruction on how to add dsp dumper, had no sound and then I discovered it

please don't close this, please try to just add 30 fps...

plese

weird english on purpose

Arm 11 error core zero

IMG_20210501_224055
I've been playing it for about 12 minutes and this happens every time can somebody help me

Poor performance on O3DS

Even at 400px with AA disabled I can't match the performance I get with a build from sm64-port/sm64-port at 800px + AA, that can otherwise run the game at full speed, except when a song starts playing, like when you pick up the wing cap.

BUG - Multiple breakages when using touchscreen menu

Non exhaustive list:

  • Wing cap; only has 1 wing after using touchscreen menu
  • Mario has no reflection in the mirror upstairs in the castle
  • Eater doesnt have a surface when viewed from below#
  • ... probably a lot more

Need to determine what is being destroyed in C3D_Fini() that needs to be re-initialised again.

Screenshots:

Wing Cap:
image

Water:
image

Bug, No 3D

Hello, i have an N3DS XL. I downloaded the 60 fps stereoscopic 3D version, but the 3D effect does not activate. I tried other versions, as well as 3dsx files instead of CIA, they do not work as well.

3D - Push all HUD elements to bottom screen

Keep the top screen clean so the stereoscopic 3D experience is not interrupted by elements of the HUD poking you in the eye.

Naive way would be to draw anything currently flagged as 2D to the bottom screen, longer term would probably involve changing the construction of the display lists to fully separate 2D/3D.

2020.09.07 edit:

Naive method has been implemented on 3ds-minimap branch when the ENABLE_N3DS_3D_MODE flag is set.

No audio on O3DS

I followed Docker and Ubuntu build insturctions with US version ROM, japanese version O3DS, Luma 10.2.1, cant get audio work. Seems no audio output at all. Am I missed some steps?
My output is a 12.4MB 3dsx file and a 7.4MB cia file.

[Feature request] Automatically disable 800px mode and AA when 3D slider gets enabled

Ideally, we should be able to leave AA enabled all the time, and it should get disabled automatically when the 3D slider is enabled, then it should be automatically enabled again when the 3D slider is off.

Like Ocarina of Time 3D does it. If you disable 3D, AA turns on. If you enable 3D, AA turns off.

So the behavior should be:
If AA option is ON -> AA is enabled when the 3D slider is off, disabled when the 3D slider is on so the 3D can work
If AA option is OFF -> AA is always off

Less intensive AA for 3D mode?

Playing around with 3D mode on my N3DS, and have noticed some occasional slowdown, most notably when viewing the entirety of Bob-omb Battlefield from atop the mountain. Disabling AA removes any noticeable slowdown. It just got me thinking if there's a less intensive AA available, maybe something like FXAA?

BUG - Shadow Z-fighting on water surfaces

zfighting

Affects Gericom. Affects Switch port and N64 original, though they appear different than this due to how alpha blending happens. Seems like it should be simple enough to solve in the same way it's been solved for all other surfaces..

Weird artifact when using anti aliasing

There is a weird artifact that can randomly occur while anti aliasing is enabled.
It is relativily hard to notice when playing normally even it seems to occurs at a fixed spot on the screen. It seems to appear more frequently if there is smoke from Mario punching that intersect with a wall or someting,
However pausing will show the artifact 100 % of the time and was the only way I could take a screenshot of it happening.

It looks like a small group of 4 pixels that is mostly grey but can change color. I think the color is related to what is on screen.
You can see the artifact on the bottom right of the pause grey area on the screenshots.

Screenshots taken with Luma3ds. I then corrected the aspect-ratio because I was playing in 800px mode.

Top row : AA disabled
Bottom row : AA enabled

artifact

I was also playing with the 60 fps patch.

Error when building with custom sounds.

I'm attempting to build a romhack of this game that others have been able to build successfully, but I'm getting the following error when attempting to implement custom sounds. Replacing the sounds with their original counterparts seems to solve the issue, but as this hack replaces several characters, this is less than ideal.

tools/aiff_extract_codebook sound/samples/sfx_mario/00.aiff >build/us_3ds/sound/samples/sfx_mario/00.table
Assertion failed: !canSeek() || (tell() == m_track->fpos_next_frame), file audiofile.cpp, line 6170
tools/vadpcm_enc -c build/us_3ds/sound/samples/sfx_mario/00.table sound/samples/sfx_mario/00.aiff build/us_3ds/sound/samples/sfx_mario/00.aifc
You should specify a coefficient codebook with the [-c] option
make: *** [Makefile:738: build/us_3ds/sound/samples/sfx_mario/00.aifc] Error 1

Additional information: I've followed the guide to the best of my ability, and have successfully compiled a non modified version of the game. Besides following the installation guide for MSYS itself and successfully compiling the PC build with sm64pcbuilder2, this is otherwise a completely fresh install of MSYS. I can provide any additional information on request. I have tried with both an original mario 64 rom and a patched version of the rom, and both throw some variation on the above error eventually when getting to custom sounds. The hack I'm trying to build can be found here, if that's worth anything: https://romhacking.com/hack/super-cream-64

The EU rom can't compile with the puppycam patch applied.

I get these errors.

In file included from src/game/camera.c:708:
src/game/../../enhancements/puppycam.inc.c:136:45: error: 'newcam_options' undeclared here (not in a function); did you mean 'newcam_options_de'?
  136 | static u8 (*newcam_options_ptr)[OPT][64] = &newcam_options;
      |                                             ^~~~~~~~~~~~~~
      |                                             newcam_options_de
src/game/../../enhancements/puppycam.inc.c:137:43: error: 'newcam_flags' undeclared here (not in a function); did you mean 'newcam_flags_de'?
  137 | static u8 (*newcam_flags_ptr)[OPT][64] = &newcam_flags;
      |                                           ^~~~~~~~~~~~
      |                                           newcam_flags_de
src/game/../../enhancements/puppycam.inc.c:138:45: error: 'newcam_strings' undeclared here (not in a function); did you mean 'newcam_strings_de'?
  138 | static u8 (*newcam_strings_ptr)[OPT][64] = &newcam_strings;
      |                                             ^~~~~~~~~~~~~~
      |                                             newcam_strings_de

FEATURE - Swap top and bottom screen in menu

I'd absolutely love it if there was an option in the menu to swap top and bottom screen. You swap back with select. This would be useful for people with broken top screens that wish to still use their 3DS.

I do not have any clue on how 3DS homebrew works, but I do know that the code that renders the frames are in /pc/gfx/gfx.c, so you could modify that code to switch top and bottom screens. Thank you.

BUG - Text is not scaled correctly

Original issue is sm64-port/sm64_3ds#15:

The suggested fix is to:

"make the gssptexture macro use 0x8000 instead of 0xffff for the s/t scale and double the texture coordinates used in the text vertices, i dont know where decomp puts those, youll have to find that yourself" - devwizard

FEATURE - Use bottom screen as map per DS

Intro

image

The DS version of SM64 used the bottom screen for a map (as well as other HUD (HDD?) elements). Rather than having a blank screen, or configuration, we could/should leverage the bottom screen for a map in the 3DS port too.

Considerations

Any assets being distributed as part of the repo need to be free from (Nintendo) copyright. If we wish to use any sprites/assets from either N64 or DS versions they should be extracted from the ROM at compile-time.

TBD: are Blender exports of levels subject to copyright?

Progress:

image image
image image
image image
image

Versions:

There are a couple ways to do this, lets call them "1.0" and "2.0". Ideally lessons learnt doing 1.0 will transfer to 2.0

1.0

This is the 'lets just get something working' version

  • Create PNG backgrounds (256x256) for each level (WIP)
    • UNKNOWN_1
    • UNKNOWN_2
    • UNKNOWN_3
    • BBH
    • CCM
      • Area 1
      • Area 2
    • CASTLE
      • Area 1
      • Area 2
      • Area 3
    • HMC
    • SSL
      • Area 1
      • Area 2
      • Area 3
    • BOB; done by me, happy to take improvements
    • SL
      • Area 1
      • Area 2
    • WDW
      • Area 1
      • Area 2
    • JRB
      • Area 1
      • Area 2
    • THI
      • Area 1
      • Area 2
      • Area 3
    • TTC
    • RR
    • CASTLE_GROUNDS
      • Moat
      • Drained
    • BITDW
    • VCUTM
    • BITFS
    • SA
    • BITS
    • LLL
      • Area 1; done by me, happy to take improvements
      • Area 2
    • DDD
      • Area 1
      • Area 2
    • WF; done by me, happy to take improvements
    • ENDING
    • CASTLE_COURTYARD
    • PSS
    • COTMC
    • TOTWC
    • BOWSER_1
    • WMOTR
    • UNKNOWN_32
    • BOWSER_2
    • BOWSER_3
    • UNKNOWN_35
    • TTM
      • Area 1
      • Area 2
      • Area 3
      • Area 4
    • UNKNOWN_37
    • UNKNOWN_38
  • Draw the correct background based on the current level being played
  • Draw the correct background based on the current AREA of the level being played
  • Determine Mario's X/Y world position and map (via scale/offset) into 0-256 and 0-256 coords
  • Overlay some kind of 'red dot' for Mario's position
  • Sprite for Mario rather than square
  • Background colour to fill transparent areas per DS version
  • Display arrow for direction Mario is facing

2.0

  • Use higher resolution png (512x512? 1024x1024? e.g, tile 4x 256x256 to make a 512x512 map)
  • TOGGLE: Rotate map based on Mario's direction (Mario always at origin 0,0, (or 160,120 - i.e. centre of the screen))
  • Zoom png based on user input?
  • Overlay assets, stars? other points of interest?
  • Change minimap based on x/y/z location of Mario e.g. Castle and BBH, levels with multiple vertical levels.

FEATURE - Move audio to CPU1

The (O)3DS has a dual core CPU. Core 0 is used for userland, Core 1 is for the OS. However 1 thread can be spawned on Core 1 and used for ~30% of the time.

It ought to be as simple as:

    s32 prio = 0;
    svcGetThreadPriority(&prio, CUR_THREAD_HANDLE);

    APT_SetAppCpuTimeLimit(30);
    threadId = threadCreate(audio_3ds_loop, 0, 32 * 1024, prio - 1, 1, true);

... but it isn't. as this crashes when transitioning to the FILE SELECT screen, if it hasn't already crashed before this point.

Note: there is no point using Core 2 or 3 on the N3DS as performance is fine when running at 804mhz.

FEATURE - Add custom icon, banner and jingle for CIA

I lack the creative talent for this, but hopefully someone can create some nice, copyright-free, assets to use when building the CIA.

  • Icon needs to be 48x48 png
  • Banner needs to be 256x128 png
  • Jingle needs to be a short .wav

BUG - Pal version speed and text

Using the Pal rom to compile results in two issues:

  1. the game is too fast and sound skips
  2. the text is garbled when not set in English: it will usually offset by one letter, and will go crazy if you move the camera when looking at a text sign

Error level rules.mk

Error level rules.mk It comes out halfway through an error about something called level rules

error when building help

when i try to build the rom it dosent workit gives me this error $ make VERSION=us --jobs 4
make: gcc: No such file or directory
make: *** [Makefile:66: n64graphics] Error 127
Traceback (most recent call last):
File "./extract_assets.py", line 292, in
main()
File "./extract_assets.py", line 162, in main
subprocess.check_call(
File "/usr/lib/python3.8/subprocess.py", line 364, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-s', '-C', 'tools/', 'n64graphics', 'skyconv', 'mio0', 'aifc_decode']' returned non-zero exit status 2.
Makefile:181: *** Failed to extract assets. Stop.

trouble installing patches

I cant get patches to work. I am using an x64 build of MSYS2 and the latest version of Ubuntu.

I have patch for pacman installed.

Here's the error:

$ tools/apply_patch.sh enhancements/60fps.patch
Do you wish to apply the patch 'enhancements/60fps.patch'? [Y/N] Y
bash: patching: command not found

Cia build crashes on real hardware

compiled latest build and it crashes. The 3dsx version works fine, but no option to use anti aliasing. Cia version also works on citra

Gamecube building boot.dol

i was able to compile the wii boot.dol file, but how can i build the boot.dol for the gamecube? or the same wii .dol work on gamecube?

error building CIA.

Timsl@LAPTOP-STVUE3H6 MSYS ~/sm64-port $ make VERSION=us cia make: gcc: No such file or directory make: *** [Makefile:66: n64graphics] Error 127 Traceback (most recent call last): File "/home/Timsl/sm64-port/./extract_assets.py", line 292, in <module> main() File "/home/Timsl/sm64-port/./extract_assets.py", line 162, in main subprocess.check_call( File "/usr/lib/python3.9/subprocess.py", line 373, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['make', '-s', '-C', 'tools/', 'n64graphics', 'skyconv', 'mio0', 'aifc_decode']' returned non-zero exit status 2. Makefile:179: *** Failed to extract assets. Stop.

full history

https://pastebin.com/sP4c6fzY

BUG - Vanish cap

Vanish cap effect does not match N64

3DS
image

N64
image

Edit:

Naive edit, applied to triangles rather than per-pixel

if (hasNoise && hasAlpha)
{
    *dst++ = buf_vbo[offset + vtxOffs++] * (rand() % 2);
}

image

Edit 2:

Seeing as there are no programmable fragment shaders on the 3DS, this is going to be tricky. Treat the colour as a texture and apply noise to that?

Can't use my PC port save with 3DS version

Whenever I try to use it, the game doesn't read it and overwrites it with a blank save. I know using a PC port save is possible, because I also tried using a complete save I downloaded on the Internet, and that one worked fine. So is there something wrong with my save file in particular?

Here's the save in case you want to take a look at it.
sm64_save_file.zip

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.