diff --git a/bsnes/Makefile b/bsnes/Makefile index f3453848..00110304 100755 --- a/bsnes/Makefile +++ b/bsnes/Makefile @@ -4,7 +4,7 @@ nes := nes snes := snes gameboy := gameboy profile := accuracy -ui := ui-debugger +ui := ui # options += console diff --git a/bsnes/base/base.hpp b/bsnes/base/base.hpp index 49bcbc68..39256a19 100755 --- a/bsnes/base/base.hpp +++ b/bsnes/base/base.hpp @@ -1,7 +1,7 @@ #ifndef BASE_HPP #define BASE_HPP -const char Version[] = "085.09"; +const char Version[] = "086"; #include #include diff --git a/bsnes/data/cheats.xml b/bsnes/data/cheats.xml index e37daddd..c9efa8a5 100755 --- a/bsnes/data/cheats.xml +++ b/bsnes/data/cheats.xml @@ -13304,7 +13304,7 @@ SZSGUGSA - Infintie time + Infinite time SZSVGTVG @@ -30509,6 +30509,10 @@ Infinite Super Bombs SZKTYPVG + + Walk through walls + EONGELAP + 5 Super Bombs on pick-up IAVTPSZA @@ -44061,10 +44065,9 @@ Infinite lives DD67-4468 - - One hit kills - DDB3-C764 - + + + DDB3-C764 Small magic power-up adds 3 instead of 1 D7C0-37A7 @@ -44639,6 +44642,37 @@ 7EEA00:FF + + Advanced Dungeons & Dragons - Eye of the Beholder (USA) + + Infinite HP + 8285-6D2C + 82DE-049B + + + No waiting to hit again + 828D-A798 + + + One hit kills (works for enemies also) + CBAA-A726 + 3CA2-AD96 + + + Pick a lawful, human male fighter and he will be at Level 8 + D68B-A474 + + + Pick a lawful, human male fighter and he will be at level 6 + D18B-A474 + + + 999,999 EXP 1st class + 7E0533:3F + 7E0534:42 + 7E0535:0F + + Adventures of Batman & Robin, The (USA) @@ -44922,10 +44956,6 @@ Infinite lives - both players 8229-37A0 - - Don't lose power-ups when you die - both players - 8229-37D0 - Infinite Bombs for American F-18 - P1 8237-47A1 @@ -44958,6 +44988,24 @@ Infinite Bombs for British IDS - P2 823D-C769 + + Don't lose power-ups when you die - both players + 8229-37D0 + + + Hit anywhere + one hit kills + 40CA-14DD + 40CA-17AD + 40C2-1FDD + 40C2-14DD + 40C2-17DD + 6DC5-1F0D + 6DCB-1DAD + + + One hit kills + 6DCB-1DAD + Infinite lives (alt) 7FB78C:02 @@ -45946,7 +45994,7 @@ - Alien vs. Predator (USA) + Alien vs Predator (USA) Invincibility 1D3B-0FAD @@ -51189,7 +51237,7 @@ - Choplifter III - Rescue & Survive (USA) + Choplifter III - Rescue-Survive (USA) Have all weapons and infinte ammo DD67-CDA7 @@ -52078,7 +52126,7 @@ - College Football USA '97 - The Road to New Orleans (USA) + College Football USA 97 (USA) Always 1st down 7E1836:05 @@ -55934,7 +55982,7 @@ - Dream TV (USA) + Dream T.V. (USA) Almost infinite health 8FA6-3DA8 @@ -57016,37 +57064,6 @@ D461-D4A7 - - Eye of the Beholder (USA) - - Infinite HP - 8285-6D2C - 82DE-049B - - - No waiting to hit again - 828D-A798 - - - One hit kills (works for enemies also) - CBAA-A726 - 3CA2-AD96 - - - Pick a lawful, human male fighter and he will be at Level 8 - D68B-A474 - - - Pick a lawful, human male fighter and he will be at level 6 - D18B-A474 - - - 999,999 EXP 1st class - 7E0533:3F - 7E0534:42 - 7E0535:0F - - F1 ROC - Race of Champions (USA) @@ -62253,7 +62270,18 @@ - Gods (USA) + Gods - The Bitmap Brothers (USA) + + Invincibility + C268-3576 + + + Continually hit anywhere + 40A2-49E8 + 40A3-4988 + 40AF-1188 + 6DAD-1988 + Shields last until at least end of the world (disable if you get stuck) 1DE7-31E8 @@ -62605,7 +62633,7 @@ - GunForce - Battle Fire Engulfed Terror Island (USA) + GunForce (USA) Invincibility 69BD-A4A1 @@ -63215,7 +63243,7 @@ - Home Improvement (USA) + Home Improvement - Power Tool Pursuit! (USA) Invincibility 6D62-4B82 @@ -66016,18 +66044,18 @@ - Jurassic Park II - The Chaos Continues (USA) (En,Fr,De,It) + Jurassic Park Part 2 - The Chaos Continues (USA) (En,Fr,De,It) Almost invincible 8BEB-C22D 8B65-1C67 - Invincibiltiy after one hit until you enter a new screen + Invincibility after one hit until you enter a new screen 82B6-C704 - Infintie health against some larger dinosaurs + Infinite health against some larger dinosaurs 6DED-3A9D @@ -66144,7 +66172,7 @@ - Kablooey (USA) + Ka-blooey (USA) Infinite lives C261-0F0D @@ -67515,7 +67543,7 @@ - King of Dragons, The (USA) + King of Dragons (USA) Invincibility - both players ED76-E4AF @@ -68864,6 +68892,15 @@ 40C6-C469 4081-1F69 + + Hit anywhere + 40E4-37A0 + 40ED-37D0 + 40E0-3DD0 + 40E0-3FA0 + 6DED-3FD0 + 6DEF-3DA0 + Infinite health - P1 7E130D:08 @@ -75159,7 +75196,7 @@ - Marvel Super Heroes - War of the Gems (USA) + Marvel Super Heroes in War of the Gems (USA) Infinite health B9D9-74D4 @@ -78156,7 +78193,7 @@ - Musya (USA) + Musya - The Classic Japanese Tale of Horror (USA) Invincibility (blinking) 7E103C:0A @@ -79477,7 +79514,7 @@ - NHLPA Hockey '93 (USA) + NHLPA Hockey 93 (USA) Period clock runs faster F160-4776 @@ -79942,7 +79979,7 @@ - Ninjawarriors, The (USA) + Ninjawarriors (USA) Invincibility EDB0-D768 @@ -80450,7 +80487,7 @@ - Operation Logic Bomb (USA) + Operation Logic Bomb - The Ultimate Search & Destroy (USA) Infinite health C2B5-4DD0 @@ -81407,7 +81444,7 @@ - Parodius da! - Shinwa kara Owarai e (Japan) + Parodius Da! - Shinwa kara Owarai e (Japan) Infinite lives 7E0098:03 @@ -81540,7 +81577,7 @@ - Phalanx - The Enforce Fighter A-144 (USA) + Phalanx (USA) Infinite health 3C21-AD0F @@ -82657,7 +82694,7 @@ - Prince of Persia 2 - The Shadow & The Flame (USA) + Prince of Persia 2 (USA) Infinite health 7E0957:03 @@ -83724,7 +83761,7 @@ - R-Type III - The Third Lightning (USA) + R-Type III (USA) Invincibility DD62-33DD @@ -83747,7 +83784,7 @@ - R.P.M. Racing (USA) + Radical Psycho Machine Racing (USA) Sturdy tires are free DDB8-0465 @@ -86788,7 +86825,22 @@ - Shaq Fu (USA) + Shaq-Fu (USA) + + Invincibility - P1 + 0D8B-8DDD + 2D8B-8D6D + 3D86-87AD + 4D8B-8D0D + + + Hit anywhere - P1 + 0D85-87DD + 3D85-84AD + 4D85-870D + DD86-8D6D + FA86-8D0D + Infinite continues - Duel Mode C269-EF0D @@ -86994,7 +87046,7 @@ - SimAnt (USA) + SimAnt - The Electronic Ant Colony (USA) Always have maximum energy DD88-0D0A @@ -87041,7 +87093,7 @@ - SimCity 2000 (USA) + SimCity 2000 - The Ultimate City Simulator (USA) Start with $99,999,999 on all the maps except the Land Of Freedom EEF3-8700 @@ -88207,7 +88259,7 @@ - Space Invaders - The Original Game (USA) + Space Invaders (USA) Infinite lives CB6F-37A9 @@ -88482,7 +88534,7 @@ - Spawn (USA) + Spawn - The Video Game (USA) Invincibility after one hit (invisible) C203-84D1 @@ -88495,10 +88547,9 @@ Infinite health C208-87D1 - - Don't blink after getting hit - FDDB-5FB9 - + + + FDDB-5FB9 Falling doesn't use life points C2F4-7FD1 @@ -88856,7 +88907,7 @@ - SpellCraft (USA) (Proto) + SpellCraft - Aspects of Valor (USA) (Proto) Infinite health 7E018D:99 @@ -89240,6 +89291,33 @@ 7E14D9:03 + + Star Fox - Super Weekend (USA) + + Infinite Shield + 7E0396:28 + + + Infinite Bombs + 7E15AF:04 + + + Infinite time (minutes) + 7EF0DA:09 + + + Infinite time (seconds tens) + 7EF0DC:09 + + + Infinite time (seconds ones) + 7EF0DB:09 + + + Have Double Blaster + 7E14D9:01 + + Star Fox (USA) (Rev 2) @@ -89267,33 +89345,6 @@ 7E0396:35 - - Star Fox (USA) (Super Weekend Competition) - - Infinite Shield - 7E0396:28 - - - Infinite Bombs - 7E15AF:04 - - - Infinite time (minutes) - 7EF0DA:09 - - - Infinite time (seconds tens) - 7EF0DC:09 - - - Infinite time (seconds ones) - 7EF0DB:09 - - - Have Double Blaster - 7E14D9:01 - - Star Ocean (Japan) @@ -99206,7 +99257,7 @@ - Tom & Jerry (USA) + Tom and Jerry (USA) Invincibility 7E14C8:33 @@ -99870,7 +99921,7 @@ - Toys (USA) + Toys - Let the Toy Wars begin! (USA) Infinite lives C261-3D7B @@ -100419,7 +100470,7 @@ - Ultima VI - The False Prophet (USA) + Ultima - The False Prophet (USA) Infinite time 89C8-D76D @@ -100630,7 +100681,7 @@ - Ultima VII - The Black Gate (USA) + Ultima - The Black Gate (USA) Infinite health 7E1CFA:E4 @@ -100730,7 +100781,7 @@ - Ultraman - Towards the Future (USA) + Ultraman (USA) Infinite health 4ABA-67DF @@ -100840,7 +100891,7 @@ - Uncharted Waters - New Horizons (USA) + New Horizons (USA) Joao starts with 156 Leadership instead of 78 BA6D-873D @@ -102087,6 +102138,19 @@ Wild Guns (USA) + + Invincibility + 4061-DFAA + + + Hit anywhere + 40B4-0DDF + 40B4-070F + 40B7-0FAF + 40BD-AD0A + 40BF-0F6F + 6DBE-DDDF + Infinite specials 7E1FA0:05 @@ -102284,7 +102348,7 @@ - Wolfenstein 3D (USA) + Wolfenstein 3-D (USA) Infinite health C2CC-5D64 @@ -102355,6 +102419,22 @@ No enemies 69E9-3A1F + + Hit anywhere + one hit kills + 4060-340D + 4060-3D6D + 4061-37DD + 4061-3DDD + 4064-3D6D + 4064-376D + 4065-37AD + 4069-340D + 4069-3D6D + + + One hit kills + 4065-37AD + Invincibility 7E00B8:FF @@ -102764,6 +102844,11 @@ Infinite lives - mission mode C2D7-5F64 + + Hit anywhere + 40E3-5766 + 6DEF-84D6 + Easy specials (press X) 3344-E701 @@ -103210,7 +103295,7 @@ EE8E-00BE - Invincibiltiy (alt) + Invincibility (alt) 7E1AFC:08 @@ -104426,6 +104511,14 @@ BE6-C4E-3BE + + Amazing Spider-Man, The (USA, Europe) + + Hit anywhere + 008-EAD-809 + 008-8CD-7FF + + Asteroids (USA, Europe) @@ -108178,7 +108271,7 @@ - Mickey's Chase (USA) + Mickey's Dangerous Chase (USA) Invincibility after first hit 001-A8E-E6E @@ -109521,6 +109614,13 @@ FA8-C1B-E61 + + R-Type II (Europe) + + Invincibility + C9F-3FE-081 + + Samurai Shodown (USA, Europe) (SGB Enhanced) @@ -110642,6 +110742,44 @@ Street Fighter II (USA, Europe) (Rev A) (SGB Enhanced) + + Invincibility + 18A-8ED-4CA + 18A-9FD-4CA + 18A-D2D-4CA + + + Hit anywhere - P1 + 00A-B1D-F7E + + + Hit anywhere - P2 + 00A-8FD-F7E + + + Fireball kills + 885-838-B3E + + + Nobody takes damage from anything but throws/grabs + 009-249-3B7 + + + Opponent can't win any normal rounds + 00B-938-E6D + + + Allows you to select a higher skill level + 093-85A-F72 + + + Fireball doesn't do any damage + 005-838-B3E + + + Fireball does more damage + 405-838-B3E + Player one starts with very little energy 013-F89-2AB @@ -110686,30 +110824,6 @@ Start with seconds on the timer 884-619-6E7 - - Allows you to select a higher skill level - 093-85A-F72 - - - Opponent can't win any normal rounds - 00B-938-E6D - - - Fireball doesn't do any damage - 005-838-B3E - - - Fireball does more damage - 405-838-B3E - - - Fireball kills - 885-838-B3E - - - Nobody takes damage from anything but throws/grabs - 009-249-3B7 - Ryu - Foot sweep doesn't do any damage 005-0B8-A2A diff --git a/bsnes/phoenix/windows/widget/button.cpp b/bsnes/phoenix/windows/widget/button.cpp index ae53f503..41e7e283 100755 --- a/bsnes/phoenix/windows/widget/button.cpp +++ b/bsnes/phoenix/windows/widget/button.cpp @@ -1,3 +1,22 @@ +#ifndef Button_SetImageList + //MinGW/32-bit has painfully outdated platform headers ... + typedef struct { + HIMAGELIST himl; + RECT margin; + UINT uAlign; + } BUTTON_IMAGELIST, *PBUTTON_IMAGELIST; + + #define BUTTON_IMAGELIST_ALIGN_LEFT 0 + #define BUTTON_IMAGELIST_ALIGN_RIGHT 1 + #define BUTTON_IMAGELIST_ALIGN_TOP 2 + #define BUTTON_IMAGELIST_ALIGN_BOTTOM 3 + #define BUTTON_IMAGELIST_ALIGN_CENTER 4 + + #define BCM_FIRST 0x1600 + #define BCM_SETIMAGELIST (BCM_FIRST+2) + #define Button_SetImageList(hwnd, pbuttonImagelist) (WINBOOL)SNDMSG((hwnd),BCM_SETIMAGELIST,0,(LPARAM)(pbuttonImagelist)) +#endif + Geometry pButton::minimumGeometry() { Geometry geometry = pFont::geometry(hfont, button.state.text); diff --git a/bsnes/snes/ppu/background/background.cpp b/bsnes/snes/ppu/background/background.cpp index cb3544cb..a3628e34 100755 --- a/bsnes/snes/ppu/background/background.cpp +++ b/bsnes/snes/ppu/background/background.cpp @@ -204,8 +204,8 @@ unsigned PPU::Background::get_tile_color() { } void PPU::Background::reset() { - regs.tiledata_addr = random(0x0000); - regs.screen_addr = random(0x0000); + regs.tiledata_addr = (random(0x0000) & 0x07) << 13; + regs.screen_addr = (random(0x0000) & 0x7c) << 9; regs.screen_size = random(0); regs.mosaic = random(0); regs.tile_size = random(0); diff --git a/bsnes/snes/ppu/sprite/sprite.cpp b/bsnes/snes/ppu/sprite/sprite.cpp index 5bc60b3e..66c71103 100755 --- a/bsnes/snes/ppu/sprite/sprite.cpp +++ b/bsnes/snes/ppu/sprite/sprite.cpp @@ -200,7 +200,7 @@ void PPU::Sprite::reset() { regs.base_size = random(0); regs.nameselect = random(0); - regs.tiledata_addr = random(0x0000); + regs.tiledata_addr = (random(0x0000) & 3) << 14; regs.first_sprite = 0; regs.priority0 = 0; diff --git a/bsnes/ui-debugger/Makefile b/bsnes/ui-debugger/Makefile index 333f34a4..6e497bed 100755 --- a/bsnes/ui-debugger/Makefile +++ b/bsnes/ui-debugger/Makefile @@ -4,7 +4,7 @@ include $(snes)/Makefile name := laevateinn ui_objects := ui-main ui-settings ui-interface ui-debugger ui-tracer ui-window -ui_objects += ui-console ui-video ui-cpu ui-smp ui-memory ui-breakpoint ui-vram +ui_objects += ui-console ui-video ui-cpu ui-smp ui-memory ui-breakpoint ui-properties ui-vram ui_objects += phoenix ruby ui_objects += $(if $(call streq,$(platform),win),resource) @@ -41,6 +41,7 @@ obj/ui-smp.o: $(ui)/smp/smp.cpp $(call rwildcard,$(ui)/*) obj/ui-video.o: $(ui)/video/video.cpp $(call rwildcard,$(ui)/*) obj/ui-memory.o: $(ui)/memory/memory.cpp $(call rwildcard,$(ui)/*) obj/ui-breakpoint.o: $(ui)/breakpoint/breakpoint.cpp $(call rwildcard,$(ui)/*) +obj/ui-properties.o: $(ui)/properties/properties.cpp $(call rwildcard,$(ui)/*) obj/ui-vram.o: $(ui)/vram/vram.cpp $(call rwildcard,$(ui)/*) obj/ruby.o: ruby/ruby.cpp $(call rwildcard,ruby/*) diff --git a/bsnes/ui-debugger/base.hpp b/bsnes/ui-debugger/base.hpp index 26979af8..f50498e0 100755 --- a/bsnes/ui-debugger/base.hpp +++ b/bsnes/ui-debugger/base.hpp @@ -29,6 +29,7 @@ using namespace ruby; #include "smp/smp.hpp" #include "memory/memory.hpp" #include "breakpoint/breakpoint.hpp" +#include "properties/properties.hpp" #include "vram/vram.hpp" extern uint8_t laevateinnLogo[121905]; diff --git a/bsnes/ui-debugger/breakpoint/breakpoint.cpp b/bsnes/ui-debugger/breakpoint/breakpoint.cpp index cef0e8e9..f73bf6d0 100755 --- a/bsnes/ui-debugger/breakpoint/breakpoint.cpp +++ b/bsnes/ui-debugger/breakpoint/breakpoint.cpp @@ -7,7 +7,7 @@ BreakpointEntry::BreakpointEntry() { addr.setFont(application->monospaceFont); data.setFont(application->monospaceFont); type.append("Read", "Write", "Exec"); - source.append("CPU-Bus", "APU-Bus", "VRAM", "OAM", "CGRAM"); + source.append("CPU", "SMP", "VRAM", "OAM", "CGRAM"); append(enable, {0, 0}, 5); append(addr, {50, 0}, 5); @@ -68,13 +68,13 @@ void BreakpointEditor::synchronize() { for(auto &bp : breakpointWriteCPU) bp.addr = cpuDebugger->mirror(bp.addr); for(auto &bp : breakpointExecCPU) bp.addr = cpuDebugger->mirror(bp.addr); - breakpointReadAPU.reset(); - breakpointWriteAPU.reset(); - breakpointExecAPU.reset(); + breakpointReadSMP.reset(); + breakpointWriteSMP.reset(); + breakpointExecSMP.reset(); - for(auto &bp : breakpoint) if(bp.type == Breakpoint::Read && bp.source == Breakpoint::APU) breakpointReadAPU.append(bp); - for(auto &bp : breakpoint) if(bp.type == Breakpoint::Write && bp.source == Breakpoint::APU) breakpointWriteAPU.append(bp); - for(auto &bp : breakpoint) if(bp.type == Breakpoint::Exec && bp.source == Breakpoint::APU) breakpointExecAPU.append(bp); + for(auto &bp : breakpoint) if(bp.type == Breakpoint::Read && bp.source == Breakpoint::SMP) breakpointReadSMP.append(bp); + for(auto &bp : breakpoint) if(bp.type == Breakpoint::Write && bp.source == Breakpoint::SMP) breakpointWriteSMP.append(bp); + for(auto &bp : breakpoint) if(bp.type == Breakpoint::Exec && bp.source == Breakpoint::SMP) breakpointExecSMP.append(bp); breakpointReadVRAM.reset(); breakpointWriteVRAM.reset(); @@ -136,8 +136,8 @@ bool BreakpointEditor::testExecCPU(uint24 addr) { //S-SMP //===== -bool BreakpointEditor::testReadAPU(uint16 addr) { - for(auto &bp : breakpointReadAPU) { +bool BreakpointEditor::testReadSMP(uint16 addr) { + for(auto &bp : breakpointReadSMP) { if(bp.addr == addr) { if(bp.compare && bp.data != smpDebugger->read(addr)) continue; debugger->print("Breakpoint #", bp.id, " hit\n"); @@ -147,8 +147,8 @@ bool BreakpointEditor::testReadAPU(uint16 addr) { return false; } -bool BreakpointEditor::testWriteAPU(uint16 addr, uint8 data) { - for(auto &bp : breakpointWriteAPU) { +bool BreakpointEditor::testWriteSMP(uint16 addr, uint8 data) { + for(auto &bp : breakpointWriteSMP) { if(bp.addr == addr) { if(bp.compare && bp.data != data) continue; debugger->print("Breakpoint #", bp.id, " hit\n"); @@ -158,8 +158,8 @@ bool BreakpointEditor::testWriteAPU(uint16 addr, uint8 data) { return false; } -bool BreakpointEditor::testExecAPU(uint16 addr) { - for(auto &bp : breakpointExecAPU) { +bool BreakpointEditor::testExecSMP(uint16 addr) { + for(auto &bp : breakpointExecSMP) { if(bp.addr == addr) { debugger->print("Breapoint #", bp.id, " hit\n"); return true; diff --git a/bsnes/ui-debugger/breakpoint/breakpoint.hpp b/bsnes/ui-debugger/breakpoint/breakpoint.hpp index 57f6f12b..d0a47b61 100755 --- a/bsnes/ui-debugger/breakpoint/breakpoint.hpp +++ b/bsnes/ui-debugger/breakpoint/breakpoint.hpp @@ -14,7 +14,7 @@ struct BreakpointEditor : Window { struct Breakpoint { enum : unsigned { Read, Write, Exec }; - enum : unsigned { CPU, APU, VRAM, OAM, CGRAM }; + enum : unsigned { CPU, SMP, VRAM, OAM, CGRAM }; unsigned id; bool compare; unsigned addr; @@ -26,9 +26,9 @@ struct BreakpointEditor : Window { vector breakpointReadCPU; vector breakpointWriteCPU; vector breakpointExecCPU; - vector breakpointReadAPU; - vector breakpointWriteAPU; - vector breakpointExecAPU; + vector breakpointReadSMP; + vector breakpointWriteSMP; + vector breakpointExecSMP; vector breakpointReadVRAM; vector breakpointWriteVRAM; vector breakpointReadOAM; @@ -41,9 +41,9 @@ struct BreakpointEditor : Window { bool testWriteCPU(uint24 addr, uint8 data); bool testExecCPU(uint24 addr); - bool testReadAPU(uint16 addr); - bool testWriteAPU(uint16 addr, uint8 data); - bool testExecAPU(uint16 addr); + bool testReadSMP(uint16 addr); + bool testWriteSMP(uint16 addr, uint8 data); + bool testExecSMP(uint16 addr); bool testReadVRAM(uint16 addr); bool testWriteVRAM(uint16 addr, uint8 data); diff --git a/bsnes/ui-debugger/console/console.cpp b/bsnes/ui-debugger/console/console.cpp index 7627746d..aa1cb0ed 100755 --- a/bsnes/ui-debugger/console/console.cpp +++ b/bsnes/ui-debugger/console/console.cpp @@ -42,10 +42,11 @@ ConsoleWindow::ConsoleWindow() { menuWindowsSMPDebugger.setText("SMP Debugger"); menuWindowsMemoryEditor.setText("Memory Editor"); menuWindowsBreakpointEditor.setText("Breakpoint Editor"); + menuWindowsPropertiesViewer.setText("Properties Viewer"); menuWindowsVRAMViewer.setText("VRAM Viewer"); menuWindows.append(menuWindowsVideoWindow, menuWindowsSeparator1, menuWindowsCPUDebugger, menuWindowsSMPDebugger, menuWindowsSeparator2, menuWindowsMemoryEditor, menuWindowsBreakpointEditor, - menuWindowsVRAMViewer); + menuWindowsPropertiesViewer, menuWindowsVRAMViewer); append(menuWindows); menuState.setText("&State"); @@ -142,6 +143,11 @@ ConsoleWindow::ConsoleWindow() { breakpointEditor->setFocused(); }; + menuWindowsPropertiesViewer.onActivate = [&] { + propertiesViewer->setVisible(); + propertiesViewer->setFocused(); + }; + menuWindowsVRAMViewer.onActivate = [&] { vramViewer->setVisible(); vramViewer->setFocused(); diff --git a/bsnes/ui-debugger/console/console.hpp b/bsnes/ui-debugger/console/console.hpp index 03bcc4fb..ab30bfba 100755 --- a/bsnes/ui-debugger/console/console.hpp +++ b/bsnes/ui-debugger/console/console.hpp @@ -24,6 +24,7 @@ struct ConsoleWindow : Window { Separator menuWindowsSeparator2; Item menuWindowsMemoryEditor; Item menuWindowsBreakpointEditor; + Item menuWindowsPropertiesViewer; Item menuWindowsVRAMViewer; Menu menuState; diff --git a/bsnes/ui-debugger/debugger/debugger.cpp b/bsnes/ui-debugger/debugger/debugger.cpp index f341a4a8..4f983364 100755 --- a/bsnes/ui-debugger/debugger/debugger.cpp +++ b/bsnes/ui-debugger/debugger/debugger.cpp @@ -14,6 +14,7 @@ void Debugger::run() { if(cpuDebugger->autoUpdate.checked()) cpuDebugger->updateDisassembly(); if(smpDebugger->autoUpdate.checked()) smpDebugger->updateDisassembly(); if(memoryEditor->autoUpdate.checked()) memoryEditor->updateView(); + if(propertiesViewer->autoUpdate.checked()) propertiesViewer->updateProperties(); if(vramViewer->autoUpdate.checked()) vramViewer->updateTiles(); } diff --git a/bsnes/ui-debugger/debugger/hook.cpp b/bsnes/ui-debugger/debugger/hook.cpp index 391e6214..86f17284 100755 --- a/bsnes/ui-debugger/debugger/hook.cpp +++ b/bsnes/ui-debugger/debugger/hook.cpp @@ -78,7 +78,7 @@ void Debugger::cpu_op_irq() { void Debugger::smp_op_exec(uint16 addr) { apuUsage.data[addr] |= Usage::Exec; smpDebugger->opcodePC = addr; - bool breakpointHit = breakpointEditor->testExecAPU(addr); + bool breakpointHit = breakpointEditor->testExecSMP(addr); if((debug.cpu && tracer->enabled() && !tracer->maskSMP(addr)) || (debug.smp && flags.step) @@ -105,7 +105,7 @@ void Debugger::smp_op_exec(uint16 addr) { void Debugger::smp_op_read(uint16 addr) { apuUsage.data[addr] |= Usage::Read; - bool breakpointHit = breakpointEditor->testReadAPU(addr); + bool breakpointHit = breakpointEditor->testReadSMP(addr); if(breakpointHit) { print(SNES::smp.disassemble_opcode(smpDebugger->opcodePC), "\n"); @@ -116,7 +116,7 @@ void Debugger::smp_op_read(uint16 addr) { void Debugger::smp_op_write(uint16 addr, uint8 data) { apuUsage.data[addr] |= Usage::Write; - bool breakpointHit = breakpointEditor->testWriteAPU(addr, data); + bool breakpointHit = breakpointEditor->testWriteSMP(addr, data); if(breakpointHit) { print(SNES::smp.disassemble_opcode(smpDebugger->opcodePC), "\n"); diff --git a/bsnes/ui-debugger/main.cpp b/bsnes/ui-debugger/main.cpp index 8d5d22e1..15eb4a5a 100755 --- a/bsnes/ui-debugger/main.cpp +++ b/bsnes/ui-debugger/main.cpp @@ -61,6 +61,7 @@ Application::Application(int argc, char **argv) { smpRegisterEditor = new SMPRegisterEditor; memoryEditor = new MemoryEditor; breakpointEditor = new BreakpointEditor; + propertiesViewer = new PropertiesViewer; vramViewer = new VRAMViewer; windowManager->loadGeometry(); @@ -79,6 +80,7 @@ Application::Application(int argc, char **argv) { cpuDebugger->updateDisassembly(); smpDebugger->updateDisassembly(); memoryEditor->selectSource(); + propertiesViewer->updateProperties(); vramViewer->updateTiles(); while(quit == false) { @@ -93,6 +95,7 @@ Application::Application(int argc, char **argv) { Application::~Application() { delete vramViewer; + delete propertiesViewer; delete breakpointEditor; delete memoryEditor; delete smpRegisterEditor; diff --git a/bsnes/ui-debugger/properties/properties.cpp b/bsnes/ui-debugger/properties/properties.cpp new file mode 100755 index 00000000..344bfa30 --- /dev/null +++ b/bsnes/ui-debugger/properties/properties.cpp @@ -0,0 +1,110 @@ +#include "../base.hpp" +PropertiesViewer *propertiesViewer = nullptr; + +PropertiesViewer::PropertiesViewer() { + setTitle("Properties Viewer"); + setGeometry({128, 128, 300, 400}); + + layout.setMargin(5); + sourceLabel.setText("Source:"); + sourceSelection.append("PPU"); + sourceSelection.setEnabled(false); + autoUpdate.setText("Auto"); + update.setText("Update"); + properties.setFont(application->monospaceFont); + + layout.append(controlLayout, {~0, 0}, 5); + controlLayout.append(sourceLabel, {0, 0}, 5); + controlLayout.append(sourceSelection, {0, 0}, 5); + controlLayout.append(spacer, {~0, 0}); + controlLayout.append(autoUpdate, {0, 0}, 5); + controlLayout.append(update, {0, 0}); + layout.append(properties, {~0, ~0}); + append(layout); + + update.onActivate = { &PropertiesViewer::updateProperties, this }; + + windowManager->append(this, "PropertiesViewer"); +} + +void PropertiesViewer::updateProperties() { + string output; + + output.append("$2100 INIDISP\n" + " Display Disable = ", SNES::ppu.regs.display_disable, "\n", + " Display Brightness = ", SNES::ppu.regs.display_brightness, "\n", + "\n" + ); + + output.append("$2101 OBSEL\n" + " Base Size = ", SNES::ppu.sprite.regs.base_size, "\n", + " Name Select = $", hex<4>(SNES::ppu.sprite.regs.nameselect << 13), "\n", + " Tiledata Address = $", hex<4>(SNES::ppu.sprite.regs.tiledata_addr), "\n", + "\n" + ); + + output.append("$2102 OAMADDL\n" + "$2103 OAMADDH\n" + " Base Address = $", hex<4>(SNES::ppu.regs.oam_baseaddr), "\n", + " Priority = ", SNES::ppu.regs.oam_priority, "\n", + "\n" + ); + + output.append("$2105 BGMODE\n" + " Mode = ", SNES::ppu.regs.bgmode, "\n", + " BG3 Priority = ", SNES::ppu.regs.bg3_priority, "\n", + " BG1 Tile Size = ", SNES::ppu.bg1.regs.tile_size ? "16x16" : "8x8", "\n", + " BG2 Tile Size = ", SNES::ppu.bg2.regs.tile_size ? "16x16" : "8x8", "\n", + " BG3 Tile Size = ", SNES::ppu.bg3.regs.tile_size ? "16x16" : "8x8", "\n", + " BG4 Tile Size = ", SNES::ppu.bg4.regs.tile_size ? "16x16" : "8x8", "\n", + "\n" + ); + + output.append("$2106 MOSAIC\n" + " BG1 Mosaic = ", 1u + SNES::ppu.bg1.regs.mosaic, "x", 1u + SNES::ppu.bg1.regs.mosaic, "\n", + " BG2 Mosaic = ", 1u + SNES::ppu.bg2.regs.mosaic, "x", 1u + SNES::ppu.bg2.regs.mosaic, "\n", + " BG3 Mosaic = ", 1u + SNES::ppu.bg3.regs.mosaic, "x", 1u + SNES::ppu.bg3.regs.mosaic, "\n", + " BG4 Mosaic = ", 1u + SNES::ppu.bg4.regs.mosaic, "x", 1u + SNES::ppu.bg4.regs.mosaic, "\n", + "\n" + ); + + lstring screenSizes = { "32x32", "32x64", "64x32", "64x64" }; + + output.append("$2107 BG1SC\n" + " BG1 Screen Address = $", hex<4>(SNES::ppu.bg1.regs.screen_addr), "\n", + " BG1 Screen Size = ", screenSizes[SNES::ppu.bg1.regs.screen_size], "\n", + "\n" + ); + + output.append("$2108 BG2SC\n" + " BG2 Screen Address = $", hex<4>(SNES::ppu.bg2.regs.screen_addr), "\n", + " BG2 Screen Size = ", screenSizes[SNES::ppu.bg2.regs.screen_size], "\n", + "\n" + ); + + output.append("$2109 BG3SC\n" + " BG3 Screen Address = $", hex<4>(SNES::ppu.bg3.regs.screen_addr), "\n", + " BG3 Screen Size = ", screenSizes[SNES::ppu.bg3.regs.screen_size], "\n", + "\n" + ); + + output.append("$210a BG4SC\n" + " BG4 Screen Address = $", hex<4>(SNES::ppu.bg4.regs.screen_addr), "\n", + " BG4 Screen Size = ", screenSizes[SNES::ppu.bg4.regs.screen_size], "\n", + "\n" + ); + + output.append("$210b BG12NBA\n" + " BG1 Tiledata Address = $", hex<4>(SNES::ppu.bg1.regs.tiledata_addr), "\n", + " BG2 Tiledata Address = $", hex<4>(SNES::ppu.bg2.regs.tiledata_addr), "\n", + "\n" + ); + + output.append("$210c BG34NBA\n" + " BG3 Tiledata Address = $", hex<4>(SNES::ppu.bg3.regs.tiledata_addr), "\n", + " BG4 Tiledata Address = $", hex<4>(SNES::ppu.bg4.regs.tiledata_addr), "\n", + "\n" + ); + + properties.setText(output); +} diff --git a/bsnes/ui-debugger/properties/properties.hpp b/bsnes/ui-debugger/properties/properties.hpp new file mode 100755 index 00000000..836fa5b9 --- /dev/null +++ b/bsnes/ui-debugger/properties/properties.hpp @@ -0,0 +1,15 @@ +struct PropertiesViewer : Window { + VerticalLayout layout; + HorizontalLayout controlLayout; + Label sourceLabel; + ComboBox sourceSelection; + Widget spacer; + CheckBox autoUpdate; + Button update; + TextEdit properties; + + void updateProperties(); + PropertiesViewer(); +}; + +extern PropertiesViewer *propertiesViewer; diff --git a/bsnes/ui/config/config.cpp b/bsnes/ui/config/config.cpp index 2d8e5579..98f9e36d 100755 --- a/bsnes/ui/config/config.cpp +++ b/bsnes/ui/config/config.cpp @@ -1,5 +1,5 @@ #include "../base.hpp" -Config *config = 0; +Config *config = nullptr; Config::Config() { attach(video.driver = "", "Video::Driver"); diff --git a/bsnes/ui/input/input.cpp b/bsnes/ui/input/input.cpp index 35f5afcf..495119b6 100755 --- a/bsnes/ui/input/input.cpp +++ b/bsnes/ui/input/input.cpp @@ -3,7 +3,7 @@ #include "snes.cpp" #include "gameboy.cpp" #include "user-interface.cpp" -InputManager *inputManager = 0; +InputManager *inputManager = nullptr; void AbstractInput::attach(const string &primaryName, const string &secondaryName, const string &tertiaryName) { string name = { primaryName, "::", secondaryName, "::", tertiaryName, "::", this->name }; diff --git a/bsnes/ui/settings/advanced.cpp b/bsnes/ui/settings/advanced.cpp index 18eeaf79..f3c0b4c5 100755 --- a/bsnes/ui/settings/advanced.cpp +++ b/bsnes/ui/settings/advanced.cpp @@ -1,4 +1,4 @@ -AdvancedSettings *advancedSettings = 0; +AdvancedSettings *advancedSettings = nullptr; AdvancedSettings::AdvancedSettings() { title.setFont(application->titleFont); diff --git a/bsnes/ui/settings/audio.cpp b/bsnes/ui/settings/audio.cpp index 2f7bd6ed..38daab46 100755 --- a/bsnes/ui/settings/audio.cpp +++ b/bsnes/ui/settings/audio.cpp @@ -1,4 +1,4 @@ -AudioSettings *audioSettings = 0; +AudioSettings *audioSettings = nullptr; AudioSlider::AudioSlider() { append(name, { 75, 0 }); diff --git a/bsnes/ui/settings/input.cpp b/bsnes/ui/settings/input.cpp index a5999b9b..80244f9d 100755 --- a/bsnes/ui/settings/input.cpp +++ b/bsnes/ui/settings/input.cpp @@ -1,4 +1,4 @@ -InputSettings *inputSettings = 0; +InputSettings *inputSettings = nullptr; InputSettings::InputSettings() : activeInput(0) { title.setFont(application->titleFont); diff --git a/bsnes/ui/settings/settings.cpp b/bsnes/ui/settings/settings.cpp index 96a6fdd5..d1ff6654 100755 --- a/bsnes/ui/settings/settings.cpp +++ b/bsnes/ui/settings/settings.cpp @@ -3,7 +3,7 @@ #include "audio.cpp" #include "input.cpp" #include "advanced.cpp" -SettingsWindow *settingsWindow = 0; +SettingsWindow *settingsWindow = nullptr; void SettingsLayout::append(Sizable &sizable, const Size &size, unsigned spacing) { layout.append(sizable, size, spacing); diff --git a/bsnes/ui/settings/video.cpp b/bsnes/ui/settings/video.cpp index 9783aa06..0f292f9f 100755 --- a/bsnes/ui/settings/video.cpp +++ b/bsnes/ui/settings/video.cpp @@ -1,4 +1,4 @@ -VideoSettings *videoSettings = 0; +VideoSettings *videoSettings = nullptr; VideoSlider::VideoSlider() { append(name, { 75, 0 }); diff --git a/bsnes/ui/tools/cheat-database.cpp b/bsnes/ui/tools/cheat-database.cpp index b5154647..9b71a512 100755 --- a/bsnes/ui/tools/cheat-database.cpp +++ b/bsnes/ui/tools/cheat-database.cpp @@ -1,4 +1,4 @@ -CheatDatabase *cheatDatabase = 0; +CheatDatabase *cheatDatabase = nullptr; CheatDatabase::CheatDatabase() { setGeometry({ 128, 128, 640, 400 }); diff --git a/bsnes/ui/tools/cheat-editor.cpp b/bsnes/ui/tools/cheat-editor.cpp index 14ebbbfa..08368f7d 100755 --- a/bsnes/ui/tools/cheat-editor.cpp +++ b/bsnes/ui/tools/cheat-editor.cpp @@ -1,4 +1,4 @@ -CheatEditor *cheatEditor = 0; +CheatEditor *cheatEditor = nullptr; CheatEditor::CheatEditor() { setTitle("Cheat Editor"); diff --git a/bsnes/ui/utility/utility.cpp b/bsnes/ui/utility/utility.cpp index 0facf416..edfc3562 100755 --- a/bsnes/ui/utility/utility.cpp +++ b/bsnes/ui/utility/utility.cpp @@ -1,5 +1,5 @@ #include "../base.hpp" -Utility *utility = 0; +Utility *utility = nullptr; void Utility::setMode(Interface::Mode mode) { video.clear(); @@ -56,7 +56,7 @@ void Utility::resizeMainWindow(bool shrink) { if(config->video.correctAspectRatio) { if(interface->mode() == Interface::Mode::NES || interface->mode() == Interface::Mode::SNES - ) width = (double)width * 1.226; + ) width = (double)width * 8.0 / 7.0; } unsigned maxW = geometry.width / width; diff --git a/bsnes/ui/window/window.cpp b/bsnes/ui/window/window.cpp index dec01b68..26f85cd7 100755 --- a/bsnes/ui/window/window.cpp +++ b/bsnes/ui/window/window.cpp @@ -1,5 +1,5 @@ #include "../base.hpp" -WindowManager *windowManager = 0; +WindowManager *windowManager = nullptr; void WindowManager::append(Window *window, const string &name) { windowList.append({ window, name, geometry(window->geometry()) });