Created
July 4, 2022 15:46
-
-
Save profi200/0a8d67715b183945b95bea088c7a7c10 to your computer and use it in GitHub Desktop.
ips_artifact_fixer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <3ds.h> | |
#define REVERSE_INTERVAL (60u * 15) | |
static void setLcdFill(const u32 val) | |
{ | |
// This relies on Luma's special memory mapping. | |
*((vu32*)(1u<<31 | 0x10202204)) = val; // Top. | |
*((vu32*)(1u<<31 | 0x10202A04)) = val; // Bottom. | |
} | |
// Note: This basically works by causing more "burn in" on the whole screen to | |
// hide the original artifacts. This will not remove all artifacts. | |
int main(int argc, char* argv[]) | |
{ | |
gfxInitDefault(); | |
consoleInit(GFX_TOP, NULL); | |
puts("IPS artifact fixer\n\n" | |
"\x1b[31mEpilepsy warning:\x1b[0m\n" | |
"This will cause visible flickering. Use at your own risk!\n\n" | |
"Usage:\n" | |
"Press A to start/stop. START to exit. Let this run for 5-10 minutes."); | |
u32 fillReg = 0; | |
u32 frameCounter = 0; | |
while(aptMainLoop()) | |
{ | |
gspWaitForVBlank(); | |
setLcdFill(fillReg); | |
gfxSwapBuffers(); | |
hidScanInput(); | |
u32 kDown = hidKeysDown(); | |
if(kDown & KEY_A) fillReg ^= 1u<<24; | |
if(kDown & KEY_START) break; | |
if((frameCounter % REVERSE_INTERVAL) != 0) fillReg ^= 0xFFFFFFu; | |
frameCounter++; | |
} | |
setLcdFill(0); // Turn it off before exiting. | |
gfxExit(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment