Language…
21 users online: 1UPdudes, Abstract,  Blaagon, CharlieUltra, dashlet, Dennsen86, DixyNL,  Eden_, GiraffeKiller, Hammerer, JezJitzu,  MarioFanGamer, Metal-Yoshi94, MorrieTheMagpie, mtheordinarygamer, Papangu, playagmes169, rafaelfutbal, Ryrir,  Segment1Zone2, TheOrangeToad - Guests: 281 - Bots: 448
Users: 64,795 (2,369 active)
Latest user: mathew

Lunar Magic's "VRAM Patch" Optimization

SMW Patches → Lunar Magic's "VRAM Patch" Optimization

Submission Details

Name: Lunar Magic's "VRAM Patch" Optimization
Author: Kevin
Added:
Tool: Asar
Requires Free Space: Yes
Bug Fix: No
Featured: Essential
Description: Welcome! This is SMW Hacking Land. In this strange land we find that NMI time is missing again! Looks like Fusoya is at it again!

Jokes aside, this patch aims at fixing a major issue with Lunar Magic's VRAM patch: using a lot of NMI cycles to modify the stripe image table, which causes blank overflows to be much more likely than vanilla. The issue is fixed by moving said code to outside of NMI, at the end of the game loop.
This allows you, for example, to change multiple blocks in a frame without black bars appearing and HDMA gradients breaking, and any kind of resource that uses stripe image in a level or in the title screen (like messages, file select menu, ...) should behave better as well in this sense.
Before applying it, make sure to have saved a level in Lunar Magic (with the "Install VRAM patch" option turned on, of course, but you'd probably never turn it off anyway). It's highly recommended that you also have FastROM turned on, as it helps with this problem (and with slowdown in general) as well.
Note that the patch uses 8 bytes of free ROM space in bank 0, which are usually not used: if you're using the same space for something else, you can change it with the define in the asm file.

NOTE: if you upgrade to Lunar Magic 3.31+, you'll need to repatch this the first time.

P.S.: In the first 2 GIFs there's 4 pairs of Mushroom Scales stacked on top of each other, to clearly show the effect.
Tags: lorom sa-1
Comments: 18 (jump to comments)
Download 2.11 KiB | 978 downloads

Screenshots

View all

Comments (18)

CSWORDS Link
How Can I Install It?
 Kevin Author Link
You can patch it with Asar. See here for more information.
MarioSMWGooder Link
yes!#smrpg{y} I Knew this that someone would make!
also works!
Francium Link
Originally posted by AppleBoy54321
Can I please use the gradient from the Last Two images?

You can try this.
JamesD28 Link
Tested with:

• Lunar Magic 3.31
• SA-1 Pack v1.40
• Asar v1.81
• Snes9x v1.60
• bsnes v115

Also used in testing:

• Dynamic Sprites Patch (DSX)
• Dynamic Spriteset System (DSS)
• PIXI v1.32
• Atari2.0 & lx5's PIXI preview build
• UberASMTool v1.4

Very nice! NMI overflows are eliminated/reduced in many situations, and no adverse effects were found, so, accepted. An essential for anyone making use of HDMA, exanimations, dynamic uploads for sprites (DSS benefits greatly from this), or just frequently using tile-changing effects.
Apple Boy Link
Can I please use the gradient from the Last Two images?
Moltz Link
So that's why the upper screen flickers with some hacks... fascinating.
 Kevin Author Link
Originally posted by simon.caio
I think that this patch substitute the pixelation effect with a plain fade in/out? Is that intentional and part of the patch?
It doesn't happen on my end. It's definitely not caused by this patch.
 Kevin Author Link
Originally posted by Anas
Excellent patch! I tested it so far and found no bugs at all. I even checked the OW event fade effect and castle destruction cutscenes just in case. Additionally, it works well with the mushroom scale fix patch.
Nice, although the Overworld isn't affected (Lunar Magic's modifications only acts in levels and on the title screen) so no need to test in those cases.
Anas Link
Excellent patch! I tested it so far and found no bugs at all. I even checked the OW event fade effect and castle destruction cutscenes just in case. Additionally, it works well with the mushroom scale fix patch.
 Kevin Author Link
Originally posted by HammerBrother
Does this mean I can change an unlimited number of blocks onscreen (COMPLETELY removing the limit), or is it that the maximum number of blocks without black bars possibly appearing is increased?

Obviously not, you're still limited by the hardware, but you just have more leniency than before. With FastROM (in a clean ROM) the limit seems to be around 10 blocks on the same frame, more than that and you get small flickering. Of course, if you have a lot of exanimations, or other stuff that uses NMI time, the limit will be lower.
 MarioFanGamer Link
Quote
Jokes aside, this patch aims at fixing a major issue with Lunar Magic's VRAM patch: using a lot of NMI cycles to modify the stripe image table, which causes blank overflows to be much more likely than vanilla. The issue is fixed by moving said code to outside of NMI, at the end of the game loop.

The heck, what? Of course, BG1 and BG2 use a different tilemap location but Lunar Magic doesn't adjust the stripe image generation code when changing blocks. Nonetheless, such a large code definitively shouldn't have been in NMI.
lx5 Link
Quote
Does this mean I can change an unlimited number of blocks onscreen (COMPLETELY removing the limit), or is it that the maximum number of blocks without black bars possibly appearing is increased?

It's a magic stick not an atomic bomb.

In a serious note, it greatly decreases the load during the game's NMI while changing blocks and whatever ese uses the stripe image table (possibly everything related to layer 3). It seems to have the same purpose as imamelia's patch but it also has a completely different approach to solve the problem.
HammerBrother Link
Does this mean I can change an unlimited number of blocks onscreen (COMPLETELY removing the limit), or is it that the maximum number of blocks without black bars possibly appearing is increased?

Also, reminds me of DMA Queue and Block Change Optimize.
 Heraga Link
This is going to revolutionize SMW Hacking, hope this gets integrated into LM proper in the next release!
 Kevin Author Link
I've updated the file with a new freespace address since I didn't realize the previous one is used for the FastROM patch. If you downloaded it before redownload it or change !freespace_bank0 to $00BA56 (if using FastROM, otherwise it doesn't matter).
lx5 Link
chad
Amomario123w Link
in a positive or bad sense?