Debugger: Lua - Added simple script to display NTSC safe areas as an overlay

This commit is contained in:
Sour 2018-06-06 20:14:19 -04:00
parent 03c8d546bd
commit b20a085734
4 changed files with 34 additions and 2 deletions

View file

@ -30,7 +30,7 @@ namespace Mesen.GUI.Debugger
{
InitializeComponent();
List<string> builtInScripts = new List<string> { "DmcCapture.lua", "DrawMode.lua", "Example.lua", "GameBoyMode.lua", "Grid.lua", "LogParallax.lua", "ModifyScreen.lua", "ReverseMode.lua", "SpriteBox.lua" };
List<string> builtInScripts = new List<string> { "DmcCapture.lua", "DrawMode.lua", "Example.lua", "GameBoyMode.lua", "Grid.lua", "LogParallax.lua", "ModifyScreen.lua", "NtscSafeArea.lua", "ReverseMode.lua", "SpriteBox.lua" };
foreach(string script in builtInScripts) {
ToolStripItem item = mnuBuiltInScripts.DropDownItems.Add(script);
item.Click += (s, e) => {

View file

@ -15,5 +15,5 @@ function onScroll(address, value)
emu.drawLine(0, state.ppu.scanline, 256, state.ppu.scanline, color, 1)
end;
emu.addMemoryCallback(onScroll, emu.memCallbackType.cpuWrite, PPUSCROLL, PPUSCROLL);
emu.addMemoryCallback(onScroll, emu.memCallbackType.cpuWrite, PPUSCROLL);
emu.displayMessage("Script", "Log Parallax")

View file

@ -0,0 +1,29 @@
-----------------------
-- Name: NTSC Safe Area
-- Author: Sour
-----------------------
-- Displays an overlay based on tepples' "Safe Area on 5.37Mhz NTSC VDPs" diagram
-- Source: https://wiki.nesdev.com/w/index.php/File:Safe_areas.png
--
-- Red: "Danger Zone" (Top and bottom 8 pixels)
-- Most TVs hide all of this.
--
-- Gray: Outside the "Title Safe Area".
-- Some TVs may hide portions of this.
-- Text, etc. should not appear here.
-----------------------
function drawSafeArea()
local red = 0x40FF0000;
local gray = 0x60505050;
emu.drawRectangle(0, 0, 256, 8, red, true)
emu.drawRectangle(0, 232, 256, 8, red, true)
emu.drawRectangle(0, 8, 16, 224, gray, true)
emu.drawRectangle(240, 8, 16, 224, gray, true)
emu.drawRectangle(16, 8, 224, 16, gray, true)
emu.drawRectangle(16, 216, 224, 16, gray, true)
end
emu.addEventCallback(drawSafeArea, emu.eventType.endFrame);

View file

@ -1169,6 +1169,9 @@
<Compile Include="RuntimeChecker.cs" />
<Compile Include="SingleInstance.cs" />
<Compile Include="TestRunner.cs" />
<None Include="Dependencies\LuaScripts\NtscSafeArea.lua">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Resources\VerticalLayout.png" />
<None Include="Dependencies\LuaScripts\DmcCapture.lua">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>