Is it possible to disable anti-aliasing in N64 games via GameShark cheats?

Discussion in 'Nintendo Game Development' started by mdmx, Feb 4, 2016.

  1. eb1560

    eb1560 <B>Site Supporter 2014</B>

    Joined:
    Apr 7, 2014
    Messages:
    61
    Likes Received:
    24
    That picture of the video output being quadrupled or multiplied is a bit peculiar though. I once swapped the video (and audio) clock crystal on the N64 motherboard to double the video clock output (or pixel bandwidth in this case) and had a similar result visually on my display (without colors due TV not recognizing "abnormal NTSC video modulation?").

    There is a VI register between divot_en and serrate that involves the video bus clock (VBUS_CLK_EN) that should apparently never be activated since it can damage the N64 hardware – or at least that is how a few Github pages describe its function.

    [​IMG]
     
  2. Fandangos

    Fandangos <B>Site Supporter 2013</B>

    Joined:
    Sep 19, 2012
    Messages:
    604
    Likes Received:
    23
    Ok, I've found the values for Super Mario 64 using nemu64.

    1. At A440000 i've found 00013016.

    2. Searched for those in memory and found them at:
    0x003359CC
    0x003359FC

    3. Tried to change 13016 to anything else without any results on the emulator side, so I need some game shark codes to test it.


    Now I'm not familiar with 8bit to 16bit conversions.
    How do I go from 003359FC to 8bit game shark value?
     
    Last edited: Feb 8, 2016
  3. bagheera

    bagheera Rising Member

    Joined:
    Aug 1, 2014
    Messages:
    65
    Likes Received:
    3
    My guess is that emulators do not apply the VI filters. Is that correct?
     
  4. rso

    rso Gone. See y'all elsewhere, maybe.

    Joined:
    Mar 26, 2010
    Messages:
    2,192
    Likes Received:
    448
    Not sure about cen64, but for the rest, I'd say that's pretty much always correct.
     
  5. xdaniel

    xdaniel Robust Member

    Joined:
    Feb 14, 2011
    Messages:
    213
    Likes Received:
    16
    Yep, pretty sure most emulators don't emulate the hardware at this level, so changing the VI Status register won't have much of an effect on them.

    As for GameShark codes, 80xxxxxx 00yy is an 8-bit write that writes value yy to the address xxxxxxxx, i.e. 803359FD 0000 would change the second byte in the register value (i.e. 01) to zero. 81xxxxxx yyyy is a 16-bit write, so 813359FC 0000 would overwrite the first and second byte in the value (i.e. 0001) with two zero bytes.

    The quadrupled Mario 64 image I posted is, as far as I can guess with my limited knowledge, probably the result of setting the hardware up to use a 32-bit framebuffer, but the game still writing 16-bit data there, i.e. one that's, byte-wise, half the size of what the hardware expects. Not sure why exactly it's quadrupled like that, and not just doubled, but the colors are roughly what you get when trying to decode 16-bit RGBA5551 pixel data as 32-bit RGBA8888.
     
  6. Zoinkity

    Zoinkity Site Supporter 2015

    Joined:
    Feb 18, 2012
    Messages:
    500
    Likes Received:
    108
    There's a good chance they use the raw framebuffer data instead of converting it like the VI does. VI filters are not simple or straightforward to emulate (much less correctly), but there's more at play than just post-processing.

    In response to the person who said it looked like they lost color depth, you did.
    Actual output on console is 7bits per channel. In all cases alpha in the framebuffers are ignored.
    In 15bit color mode noise dither and gamma correction is added to the five bits of data per channels to produce the output.
    In "32bit" color mode only the 24bits of color are used. The least significant bits of the eight bit channels are dropped and said VI effects are added to produce output.
    So on real hardware, even before you factor in RGB->YIQ/YUV conversion, there's effectively no difference in quality between the two video modes but there's a significant difference in resources used.

    32bit color mode means you eat double the rdram per framebuffer compared to 16bit color. It can operate in two modes though. In single-cycle mode only one framebuffer is needed, but this is usually washed out. There's the potential for a run condition when filling it as well, but mostly it's that it looks bad. Two-cycle mode alternates between framebuffers, which is basically what 16bit output is locked into using. This consumes twice the rdram though, and framebuffers eat a lot of memory: width * height * depth * num.

    So, it should be obvious now why you're seeing four images. The first two are simple: you doubled the amount of info you read on each scanline (from 16 to 32 bits). 32bit framebuffers are twice as long so you see double the info at one time. The other two images are due to 32bit framebuffers being twice as long as well. You're actually viewing two 16bit framebuffers at the same time.
     
    Last edited: Feb 8, 2016
  7. mdmx

    mdmx Familiar Face

    Joined:
    Nov 3, 2005
    Messages:
    1,303
    Likes Received:
    29
    Beetle Adventure Racing (PAL):
    00 01 30 12 found at 0x80020A8C and 0x80020ABC

    GameShark Code:
    80020A8D 0000
    80020ABD 0000


    Extreme G (PAL):
    00 01 30 16 found at 0x8009C094 and 0x8009C0C4

    GameShark Code:
    8009C095 0000
    8009C0C5 0000
    8009C096 0032
    8009C0C6 0032
     
    smoke monster likes this.
  8. xdaniel

    xdaniel Robust Member

    Joined:
    Feb 14, 2011
    Messages:
    213
    Likes Received:
    16
    Here's a more proper list of the codes I worked out, both previously mentioned and some new ones:

    Blast Dozer (JPN):
    8130706C 0000
    8130706E 3216
    8130709C 0000
    8130709E 3216

    F-Zero X (JPN):
    810D301E 3202
    810D304E 3202

    Mario Kart 64 (USA):
    810EB3DC 0000
    810EB3DE 3216
    810EB40C 0000
    810EB40E 3216

    Pokemon Snap (USA):
    81042E5C 0000
    81042E5E 0212
    81042E8C 0000
    81042E8E 0212

    Snowboard Kids (PAL):
    810E056C 0000
    810E056E 3202
    810E059C 0000
    810E059E 3202

    Star Fox 64 (USA v1.0):
    810C3A6C 0000
    810C3A6E 320E
    810C3A9C 0000
    810C3A9E 320E

    Super Mario 64 (JPN):
    813348BC 0000
    813348BE 3216
    813348EC 0000
    813348EE 3216

    Super Smash Bros. (PAL):
    8103DB3C 0000
    8103DB3E 0212
    8103DB6C 0000
    8103DB6E 0212

    Zelda: Ocarina of Time (J/U v1.2):
    810069EC 0000
    810069EE 3216
    81006A1C 0000
    81006A1E 3216

    Zelda: Ocarina of Time (PAL v1.0):
    810068EC 0000
    810068EE 3216
    8100691C 0000
    8100691E 3216

    There's also this one, but I'm not sure if it's actually working...

    Zelda: Majora's Mask (PAL)
    8109811C 0000
    8109811E 3216
    8109814C 0000
    8109814E 3216
     
    smoke monster likes this.
  9. Fandangos

    Fandangos <B>Site Supporter 2013</B>

    Joined:
    Sep 19, 2012
    Messages:
    604
    Likes Received:
    23
    Why does c4 becames c5 and 94 becomes 95? why do you add 1 at the end?

    And for 013012 you replace with 0000 and for 013016 you replace it for 0032? Is that correct?
    The USA Mario 64 rom only has 013016 and no 013012, so I just replace it for 0032?
     
  10. Deka

    Deka Rising Member

    Joined:
    Nov 2, 2012
    Messages:
    72
    Likes Received:
    0
    Haven't been logged in here in awhile. A friend pointed me to this thread. I too have a xrgb-mini.
    I think this needs to be wiki-fied somewhere for codes and explanations.

    Hats off to who ever figured this out.

    Thoughts?
     
  11. AtomizerZero

    AtomizerZero Intrepid Member

    Joined:
    Aug 13, 2013
    Messages:
    646
    Likes Received:
    117
    I pretty much said the same thing on the previous page :p but yeh, I agree.
     
  12. mdmx

    mdmx Familiar Face

    Joined:
    Nov 3, 2005
    Messages:
    1,303
    Likes Received:
    29
    Because I'm using 8bit GameShark codes. I do only replace 01 for 00 and NOT 0001 for 0000

    For Beetle Adventure Racing I replace 00013012 for 00003012

    For most other games I replace 00013016 for 00003216
    If you want it super sharp, then replace it for 00003316

    I've modified Duke Nukem 64 (PAL). I have made a photo for each step. Start the slideshow to compare it.

    Photos from left to right:
    Default, 00003016, 00003216, 00003316

    Duke64_PAL_default.jpg Duke64_PAL_00.jpg Duke64_PAL_32.jpg Duke64_PAL_33.jpg

    GameShark code for last picture:
    8110219C 0000
    811021CC 0000
    8110219E 3316
    811021CE 3316

    btw, I have to use 16bit GS codes, because 8bit GS codes do not work properly in this case.
     
    Last edited by a moderator: Jul 6, 2017
    smoke monster likes this.
  13. AtomizerZero

    AtomizerZero Intrepid Member

    Joined:
    Aug 13, 2013
    Messages:
    646
    Likes Received:
    117
    So, I assume this is possible on an Everdrive 64, right?

    If so, would love a guide on how to do this!
     
    smoke monster likes this.
  14. xdaniel

    xdaniel Robust Member

    Joined:
    Feb 14, 2011
    Messages:
    213
    Likes Received:
    16
    Do note that this setting might cause some unwanted distortion, like here on the corners of the magic meter, and the no-longer round button icons:

    [​IMG]
    [​IMG]

    Edit: It also completely breaks the NTSC version of the game, the above screenshots are from the PAL one.
     
    Last edited: Feb 8, 2016
    smoke monster likes this.
  15. smoke monster

    smoke monster Rapidly Rising Member

    Joined:
    May 2, 2013
    Messages:
    93
    Likes Received:
    17
    This is a really important thread for those of us with PVMs. Thanks to everyone who has contributed.

    For those who wonder why this is something people are so interested, it's because when you play an N64 in RGB on a PVM or CRT, the image looks terrible as a result of the filter. The video that Fandangos linked to shows how bad it looks.

    The Xbox flicker/soften filter does the same thing when the Xbox is in SD video mode (RGB and composite). When I applied the FilterFucker patch to my games (similar to what is being done here for the N64), it made the Xbox look downright stunning on my PVM. It looks like this will make as drastic of a difference for the N64.
     
  16. mdmx

    mdmx Familiar Face

    Joined:
    Nov 3, 2005
    Messages:
    1,303
    Likes Received:
    29
    I agree, the setting 33 is not suitable for every game or gamer. However it is actually used in a few games, e. g. Doom 64 or Quake 2.

    btw, I haven't modified NTSC games at all because most games in my collection are PAL.
     
  17. xdaniel

    xdaniel Robust Member

    Joined:
    Feb 14, 2011
    Messages:
    213
    Likes Received:
    16
    Ah, I'm not saying that there's no game that uses the setting, just that some games that are not meant for it might look worse than others, objectively or subjectively, when forcing it. Or even worse, while the setting might work for one version of one game, it might not work for a different version of the same game, like my OoT NTSC vs PAL example; I had linked a screenshot of the breakage in my first post in the thread.

    Basically, what I'm trying to say, as advice for everyone wanting to experiment with this: Don't expect one game to behave like the next, you might have to tweak the settings a bit.
     
  18. Fandangos

    Fandangos <B>Site Supporter 2013</B>

    Joined:
    Sep 19, 2012
    Messages:
    604
    Likes Received:
    23
    If you use the original Everdrive 64 OS by Krikzz it's easy. just add using the game select menu.

    If you use the Alt64 menu by Saturnu you need to have the cheat files in ED64\Cheats folder in the root of your SD card.
    The cheats must be in YALM format, that can be edited by Notepad++ *use notepad++, even textpad didn't work.
    There are a bunch of examples in there, so just copy one and rename the cheats and add the values posted in this thread.



    EDIT:

    I'm still not 100% sure of how this is properly converted to game shark codes but this will cut the finding and digging proccess.

    Banjo-Kazooie (USA) (Rev A)
    No 00 01 30 12 found
    No 00 01 30 16 found.

    00 01 30 06 found at:
    0x002761FC
    0x0027622C


    007 - The World Is Not Enough (USA)
    00 01 30 12 found at A4400000

    00 01 30 12 found at:
    0x000D10FC
    0x000D112C

    No 00 01 30 06 found
    No 00 01 30 16 found

    Castlevania (USA) (Rev B)
    00 01 30 12 found at A4400000

    00 01 30 12 found at:
    0x000A28CC
    0x000A28FC

    No 00 01 30 16 found
    No 00 01 30 06 found


    Castlevania - Legacy of Darkness (USA)
    00 01 30 52 found at A4400000

    00 01 30 52 found at:
    0x000BB8BC
    0x000BB8EC

    No 00 01 30 16 found
    No 00 01 30 06 found
    No 00 01 30 12 found

    Dr. Mario 64 (USA)
    00 01 30 12 found at A4400000

    00 01 30 12 found at:
    0x000107EC
    0x0001081C


    No 00 01 30 16 found
    No 00 01 30 06 found


    Killer Instinct Gold (USA) (Rev B)
    00 00 32 42 found at A44000000

    00 00 32 42 found at:
    0x00006FEC
    0x0000701C

    No 00 01 30 16 found
    No 00 01 30 06 found
    No 00 01 30 12 found


    EDIT 2:
    I think I figured it out

    code for banjo kazoie
    802761FC 0000
    8027622C 0000

    Results:
    Before
    [​IMG]

    After
    [​IMG]
     
    Last edited: Feb 8, 2016
  19. joe19

    joe19 Rapidly Rising Member

    Joined:
    Aug 31, 2014
    Messages:
    79
    Likes Received:
    20
    Just some observations:
    1) What you are modifying - The value that you guys have found appears to be the value that the VI Manager saves when it switches frame buffers. For games that use 2 or more frame buffers, the context of the frame buffer (which includes the 0xA4400000 VI status register) is saved when the frame buffer is swapped out, and restored the next time that buffer is used. Two frame buffers == two saved contexts which is why so many games have the context value appear twice in succession.

    2) More AA is possible - Games used anti-aliasing 2 ways (that I know of) - silhouette AA, and internal AA. The VI is responsible for the external silhouette AA, which has been addressed in this thread by changing the saved VI context. However, the blender in the RDP will still perform internal AA on the objects via the gDPSetRenderMode gbi command. If you want to disable internal AA as well, you'll need to modify every instance of this gbi command (there are usually a ton of them!), but I don't know how much of a difference disabling internal AA would make.
     
  20. kuze

    kuze Peppy Member

    Joined:
    Sep 28, 2011
    Messages:
    371
    Likes Received:
    6
    This is pretty awesome stuff!

    So if it's possible to achieve this using gameshark codes, you could probably also pre-patch ROMs for use on an everdrive?
     
    smoke monster likes this.

Share This Page