207 Commits

Author SHA1 Message Date
Christopher Pow 8e4d1b6ed9 Hello again. 2022-05-01 15:33:23 -05:00
Christopher Pow 9d16ed8ecb Attempt fix for CBitmap improper delete of embedded QPixmap. 2021-04-01 08:44:42 -05:00
Christopher Pow 9d0845cdfd Maybe fix for OSX Travis build? 2021-03-13 20:54:58 -06:00
Christopher Pow 5b05f984f6 Fixing bug in CEvent::SetEvent and removing MAC SDK spec from pro files. 2021-01-01 13:31:20 -06:00
Christopher Pow 2fb63142d0 Prevent runaway memory for qmetacallevents. But not ideal. 2020-11-14 19:42:10 -06:00
Christopher Pow be1bb585cd Force build. 2020-11-11 14:28:33 -06:00
Christopher Pow cd6d736291 Fix qt install osx? 2020-11-10 20:17:05 -06:00
Christopher Pow b836d737e8 Force build. 2020-11-10 19:15:47 -06:00
Christopher Pow 762ee8bc05 Fix for broken build in OSX. 2020-10-21 09:08:41 -05:00
Christopher Pow 3dbaca7ab2 trying to peg qt in osx deploy. 2020-10-13 11:58:32 -05:00
Christopher Pow 908b91a089 Fix deploy for windows? 2020-10-13 10:14:58 -05:00
Christopher Pow 100aa7ddf4 Fixing qhexedit yet again. 2020-10-13 10:12:12 -05:00
Christopher Pow c8da511776 Freaking qhexedit. 2020-10-13 09:20:26 -05:00
Christopher Pow ca17023731 Freaking qhexedit. 2020-10-13 09:18:06 -05:00
Christopher Pow e1b64131c6 Fix for qhexedit link. 2020-10-13 08:13:41 -05:00
Christopher Pow c04c7c3ab3 Macbuildfix. 2020-10-11 13:53:35 -05:00
Christopher Pow 4664d3938b Fix deploys? 2020-10-10 16:26:02 -05:00
Christopher Pow 928e8dd236 Fix typo in linux deploy. 2020-10-10 10:27:16 -05:00
Christopher Pow 4557015e8a Adding qhexedit to osx link. 2020-10-10 10:21:40 -05:00
Christopher Pow d920cf5bcd Bugfix MMC5 audio toggles. Buildfix emulator on Windows. 2020-09-25 10:51:55 -05:00
Christopher Pow a57f29b422 Forgot to disable temporary hack for hex edit in memory views. 2020-09-25 08:43:29 -05:00
Christopher Pow 616c53b8af Missed file in addons? 2020-09-25 08:19:57 -05:00
Christopher Pow 68d95dff1f Fix for improper itemSelectionChanged behavior in EnvironmentSettingsDialog and ProjectPropertiesDialog and ProjectBrowserDockWidget. Moving model string buffers into classes. Adding QHexEdit views for PRGROM bank display and, hopefully, memory views and etc. 2020-09-25 08:18:34 -05:00
Christopher Pow d16d22bbb7 Singleton plugin manager. 2020-04-18 20:58:46 -05:00
Christopher Pow c68737d8d8 Removing main.h 2020-04-01 20:54:44 -05:00
Christopher Pow a741d48942 Add CHR ROM bank if new graphics banks require it. 2020-03-31 12:22:39 -05:00
Christopher Pow 5071755194 Show live changes to CHRROM banks on recompile. 2020-03-30 15:56:26 -05:00
Christopher Pow b324961640 Adding logic to graphics bank manipulation. 2020-03-29 14:37:21 -05:00
Christopher Pow c050e06fde Preparing to gut project internals. 2020-03-28 13:52:09 -05:00
Christopher Pow c90fc041d8 Stack corruption MMC5. 2020-03-26 15:55:02 -05:00
Christopher Pow 3cb0fa530d Stack corruption MMC5. 2020-03-26 15:54:03 -05:00
Christopher Pow 91a5f7dd4d Don't check for emulator if no project loaded. 2020-03-26 15:32:10 -05:00
Christopher Pow 7268bf4105 Fix for crashes on project closure/open. 2020-03-26 15:04:36 -05:00
Christopher Pow c6ab6c4484 Fixes for crashes. 2020-03-25 20:23:09 -05:00
Christopher Pow 922443e6b5 Fix non-zero offset for SLOC for EXRAM. 2020-03-24 17:48:17 -05:00
Christopher Pow efbfe88481 Fix for memory overwrite issue. Left in a breadcrumb for traceability if it recurs. 2020-03-24 16:07:54 -05:00
Christopher Pow 65145818ef Rework frontloading. 2020-03-24 13:36:52 -05:00
Christopher Pow 993e4f2120 Fixes for crash in Linux and OSX. 2020-03-24 10:13:23 -05:00
Christopher Pow 05b5ab3a0c Fix for local builds in Linux. 2020-03-22 13:39:40 -05:00
Christopher Pow 14c32d601e Clean script updates. 2020-03-21 13:53:38 -05:00
Christopher Pow 1d9aeed278 Fixing path mess. 2020-03-21 09:56:10 -05:00
Christopher Pow 2d559eb758 Broken Travis? 2020-03-21 09:48:04 -05:00
Christopher Pow 34a7fa6c47 MMC5 fixes again. 2020-03-19 15:57:22 -05:00
Christopher Pow a6ad4f03cc Fix bug in SRAM allocation in MMC5. 2020-03-19 15:23:32 -05:00
Christopher Pow 90b45b1e84 Virtualizing destructors now that some classes are poly. Also removing redundant derived class object deletions even though they reallocate the object...the base class deletion was causing exceptions. 2020-03-19 13:12:39 -05:00
Christopher Pow a49a424948 Potential fix for MMC5 crash. 2020-03-19 12:07:08 -05:00
Christopher Pow 10320371bf Fixing application of add-ons on new project creation. 2020-03-19 10:27:14 -05:00
Christopher Pow c79728bacf Fixes to MMC5 banking. Still doesn't work right for Just Breed etc. 2020-03-19 08:50:40 -05:00
Christopher Pow 1495f180b2 Adjust MMC3 PRG/CHR remapping to be consistent with doc. 2020-03-18 19:12:59 -05:00
Christopher Pow b4ff3db93d Fix MMC3 PRG remap typo. 2020-03-18 17:47:43 -05:00
Christopher Pow 378b4cfbaf Use n-2th bank for MMC5 init at A000. 2020-03-18 16:57:57 -05:00
Christopher Pow c8d2d7df3c Fix bug in custom rules serializer. 2020-03-18 16:41:45 -05:00
Christopher Pow b32203c69e Adding support for multiple custom makefile rules files so that add-ons can provide custom rules. Adding FamiTone2 tools to path. Adding export capability to Music files. 2020-03-18 16:23:12 -05:00
Christopher Pow abeb54439a Adding file properties for specification of file-specific parameters like build inclusion. Adding add-on wizard for presentation of addons like FamiTone2 and ability to include add-ons in project. Added FamiTone2 addon template. Starting to whittle away at some redundant project item searching code. 2020-03-17 15:43:21 -05:00
Christopher Pow da6eef757d Fixing linenumbers in prg display hex. Highlight open items on hover. 2020-03-15 13:32:09 -05:00
Christopher Pow c1cab1b53b Adding famitone2. 2020-03-14 22:31:29 -05:00
Christopher Pow 1ef7979eda Fixing linux deploy. 2020-03-14 15:38:51 -05:00
Christopher Pow b3510eb5b9 Fixing deployment of CC65 and UC65. Fixing local deployment for OSX. 2020-03-14 15:06:36 -05:00
Christopher Pow b9c61d4d75 Fixing UC template. 2020-03-14 13:08:05 -05:00
Christopher Pow f5a9d131bb Fixing C template so it actually runs. 2020-03-14 12:55:56 -05:00
Christopher Pow 563a4d307b Always show emulator on debugging mode. 2020-03-14 11:37:03 -05:00
Christopher Pow cc33e59ff3 Fixing C template. Fixing template nesproject file naming and project naming on new project creation. 2020-03-14 11:06:42 -05:00
Christopher Pow 95f1e9009b Run unix2dos on templates to try to rid the world of extraneous CRLF. 2020-03-13 17:41:47 -05:00
Christopher Pow 6bf0cefdac Adding close buttons in open items list to replace close buttons on tabs so that open items can be closed if tabs are not visible. 2020-03-13 17:24:45 -05:00
Christopher Pow 9c133a6612 Adding option to hide tabs in editor area (just use open items in project browser. Also fixed showing of modification state of files in open items list. 2020-03-12 16:00:13 -05:00
Christopher Pow efad631cd4 Exection inspector resizes columns on pause. 2020-03-11 23:01:26 -05:00
Christopher Pow bec5296b88 Breakpoint dialog layout fixes. 2020-03-11 21:29:32 -05:00
Christopher Pow a5ad5670e1 Force build. 2020-03-11 16:49:38 -05:00
Christopher Pow a0fbc8c7e5 Fix OSX local build but not sure how to fix deployment of CC65 yet. 2020-03-11 11:02:20 -05:00
Christopher Pow 0edd5e0085 Update README.md 2020-03-11 10:46:02 -05:00
Christopher Pow c9c374df9d Update README.md 2020-03-11 10:45:23 -05:00
Christopher Pow 96fb970da8 Update README.md 2020-03-11 10:44:09 -05:00
Christopher Pow 2e272cfbe9 Update README.md 2020-03-11 10:43:05 -05:00
Christopher Pow ea3434b3d7 Update README.md 2020-03-11 10:40:09 -05:00
Christopher Pow 9ac2faa5cd Fix for Issue #55. Also fix for test executive showing recorded input. 2020-03-11 07:51:39 -05:00
Christopher Pow daea5b382a Fix for test suite executive not running tests properly. Fix for not-found ROM causing emulator to appear hung. 2020-03-10 14:25:14 -05:00
Christopher Pow 08b94785bd Fix for not being able to remove music files from project. 2020-03-07 22:54:26 -06:00
Christopher Pow 2f8dfac102 Fix build error Windows. 2020-03-07 19:38:01 -06:00
Christopher Pow b6317ea75c Rework threading model for search, compile, breakpoint, and debuggers. Instantiate singleton CC65 interface instead of static class. 2020-03-07 16:26:49 -06:00
Christopher Pow 3d7a513d89 Fixes for problems in Windows with usage of open bus memory class. 2020-03-06 20:37:16 -06:00
Christopher Pow 010ca8be62 More versioning for appveyor. 2020-03-04 14:58:21 -06:00
Christopher Pow 775229a034 More versioning for appveyor. 2020-03-04 14:53:47 -06:00
Christopher Pow 59d6297a4f More versioning for appveyor. 2020-03-04 14:52:48 -06:00
Christopher Pow 616816037d More versioning for appveyor. 2020-03-04 14:43:00 -06:00
Christopher Pow 9583c4c066 Shortening commit hash for Windows build id. 2020-03-04 14:31:58 -06:00
Christopher Pow 93df42983a Change version compare to string. 2020-03-04 13:15:09 -06:00
Christopher Pow fb13cb7370 Fix for remembering project debuggers open on project change. 2020-03-01 14:49:28 -06:00
Christopher Pow 3a9d7ef9c1 Fixes for crashing on project opening. Fix for MMC5 scanline IRQ re-firing. Still not perfect MMC5 -- Castlevania III works but not much else. 2020-03-01 11:36:33 -06:00
Christopher Pow 6a90008a28 MMC5 fixes. Some optimizations based on profiling observations. Mapper Information and Mapper Memory display fixes. 2020-02-28 06:32:09 -06:00
Christopher Pow 5a77459b84 Remove QtFT diagnostic prints. 2020-02-19 10:11:52 -06:00
Christopher Pow 89d4399bfe Merge conflict resolution. 2020-02-19 08:59:45 -06:00
Christopher Pow 2dbceb9522 Fix for FamiTracker library consuming 100% CPU. 2020-02-19 08:55:14 -06:00
Christopher Pow 1a18cc50ba Removing repaint calls. 2020-02-13 11:43:53 -06:00
Christopher Pow 6453014b95 Changing variable naming to avoid confusion between physical and virtual machine addresses. Some usability improvements like cursor position notations on visualizers. 2020-02-10 20:25:54 -06:00
Christopher Pow 3c5a029598 Updating readme with latest used Qt version. Removing some dead code. 2020-02-09 11:11:42 -06:00
Christopher Pow 76591dad18 Optimization attempts. Also finally fixed the comment syntax highlighter in C files. 2020-02-08 15:43:52 -06:00
Christopher Pow 91357d099c Fixing windows deploy script for the umpteenth time. 2020-02-07 18:14:22 -06:00
Christopher Pow 80b78a300a Some rework and appveyor madness. 2020-02-07 15:42:17 -06:00
Christopher Pow 65f0da89d4 Trying once more for AppVeyor deploy. 2020-02-07 14:59:31 -06:00
Christopher Pow 889e2bab1f Ugh AppVeyor. 2020-02-07 10:54:29 -06:00
Christopher Pow 6063181cb4 Ugh AppVeyor. 2020-02-07 10:15:59 -06:00
Christopher Pow 1afe2ebc67 Trying to fix appveyor->bintray. 2020-02-07 08:26:28 -06:00
Christopher Pow 0351d0df82 Fix for project file destruction on exit when adding new files. Removing unnecessary recursive lock on CMutex. 2020-02-07 08:22:12 -06:00
Christopher Pow c478a0340c Fix for duplicate files on template explosion. Reducing threading to try to reduce CPU overhead. 2020-02-06 16:47:04 -06:00
Christopher Pow 017f1fe697 Fixes for OpenGL context corruption on QDockWidget content reparenting. 2020-02-05 17:27:23 -06:00
Christopher Pow 5a9e6f1f31 Merge branch 'master' of github.com:christopherpow/nesicide 2020-02-03 16:28:21 -06:00
Christopher Pow 6b03be7d14 Merge of reworked emulator core to master. 2020-02-03 16:28:13 -06:00
Christopher Pow a8a615b574 Merge pull request #58 from jstasiak/gitignore-makefiles
Gitignore all Makefiles
2020-01-31 12:34:01 -06:00
Jakub Stasiak 00276e893b Gitignore all Makefiles
Before this change the following build artifacts aren't properly ignored
(at least on Mac OS):

    apps/ide/Makefile.nesicide
    apps/nes-emulator/Makefile.nesicide-emulator
    libs/c64/Makefile.c64-emulator-lib
    libs/nes/Makefile.nes-emulator-lib

Instead of listing them one by one I went ahead and used a wildcard.
There are no Makefiles in the repository so this change doesn't affect
any tracked files.
2020-01-31 17:45:15 +01:00
Christopher Pow 5d7ecfc55a Merge pull request #57 from jstasiak/improve-qt-documentation
Add some info about installing and using Qt 5 from Homebrew
2020-01-31 10:13:43 -06:00
Christopher Pow f9eb913515 Merge branch 'master' into improve-qt-documentation 2020-01-31 10:13:34 -06:00
Christopher Pow 53d29d6d31 Merge pull request #56 from jstasiak/fix-readme
Fix build and deploy instructions/paths in the readme
2020-01-31 10:11:16 -06:00
Christopher Pow fd0891c0cb Merge pull request #51 from trevormerritt/patch-1
Update README.md - QT URL Changed
2020-01-31 10:10:32 -06:00
Jakub Stasiak d01880ae99 Add some info about installing and using Qt 5 from Homebrew 2020-01-31 16:44:53 +01:00
Jakub Stasiak b1def98876 Fix build and deploy instructions/paths in the readme
The scripts depend on being called from a directory containing the build
directory.
2020-01-31 16:34:23 +01:00
Christopher Pow 0a0f8032b6 Not sure what I changed in the mainwindow.ui. 2020-01-30 17:42:06 -06:00
Christopher Pow 7a42520a07 Damnit Bintray, 2. 2020-01-30 13:53:12 -06:00
Christopher Pow 3ea4fa77d4 Damnit Bintray. 2020-01-30 13:14:57 -06:00
Christopher Pow 5593b9cf94 Adding UTF-8 or Latin-1 encoding option to Code Editor settings. 2020-01-30 11:11:24 -06:00
Christopher Pow b174b7d4c0 Merge. 2020-01-30 08:01:47 -06:00
Christopher Pow 15a4bb5586 Fix to UI forms. 2020-01-30 07:40:08 -06:00
Christopher Pow 74b265ca93 Some minor UI fixes. Attempt to fix crash on SDL callback. Also why does emulator toolbar item disappear. 2020-01-30 07:38:30 -06:00
Christopher Pow 7d4c0bed1b Some layout issues addressed. 2020-01-29 09:39:46 -06:00
Christopher Pow c584252a21 Fixes for rendering problems and crash on project closure. 2020-01-28 14:55:33 -06:00
Christopher Pow aac587ce83 Merge branch 'reworkemucore' of github.com:christopherpow/nesicide into reworkemucore 2020-01-28 07:49:32 -06:00
Christopher Pow e6eed7f5f5 Fixes for rendering problems. Not quite there yet. Also optimized some database functions. 2020-01-28 07:49:20 -06:00
Christopher Pow 304ccfda40 Fixing Appveyor deployment. 2020-01-27 15:17:32 -06:00
Christopher Pow d87420ed00 Trying to fix Appveyor deployment. 2020-01-27 15:14:56 -06:00
Christopher Pow 68a9046584 Merge branch 'master' of https://github.com/christopherpow/nesicide 2020-01-27 15:14:07 -06:00
Christopher Pow d7662ddc2f Trying to fix Appveyor deployment. 2020-01-27 15:13:11 -06:00
Christopher Pow 1a18c2616f Trying to fix Appveyor deployment. 2020-01-27 15:12:04 -06:00
Christopher Pow 522e55fee7 Merge pull request #53 from newhoa/patch-1
README.md - Install section - file name fix
2020-01-26 17:20:08 -06:00
Christopher Pow 654987c9a7 Updating OSX build version for Travis. 2020-01-21 09:23:19 -06:00
Christopher Pow 1c144fc5a8 Updating OSX version for Travis. 2020-01-21 09:19:04 -06:00
Christopher Pow 3cb26c33bf Fixes for OpenGL context and texture problems. Pathing issues for compiler in OSX. 2020-01-20 20:11:10 -06:00
Christopher Pow c22439189f Fix for QGLWidget to QOpenGLWidget. Not quite working yet but need to transfer to Windows. 2020-01-20 14:47:27 -06:00
Christopher Pow 92984655e1 Fixing memory leak bugs around APU sample buffers. 2020-01-15 15:35:20 -06:00
newhoa 9462d2d5f8 README.md - Install section - file name fix
The ./build.sh under Linux and MacOS are missing part of their file names, linux-build.sh and osx-build.sh
2020-01-06 03:48:09 -05:00
Christopher Pow a9f16afb39 Removing non-master branches from Travis. 2019-12-31 14:33:45 -06:00
Christopher Pow 4f84d6eb85 Adding worker emulator object to separate slot/signalling for thread. 2019-12-29 21:15:42 -06:00
Christopher Pow 5be35f16fd Removing kill from emu thread. 2019-12-28 20:51:40 -06:00
Christopher Pow 53f25b10aa Bugs. 2019-12-17 19:52:30 -06:00
Christopher Pow e03cd8d02e Fixing appveyor deployment. 2019-11-15 12:56:11 -06:00
Christopher Pow c086d5afc6 Fixing appveyor deployment. 2019-11-15 10:30:58 -06:00
Christopher Pow b7731c7c6c Fixing appveyor deployment. 2019-11-15 09:47:26 -06:00
Christopher Pow f6d63c6429 Removing windows build from travis. 2019-11-15 08:38:57 -06:00
Christopher Pow c7c45c2807 Minor appveyor fix. 2019-11-15 08:04:44 -06:00
Christopher Pow 38afc3b3af Appveyor deployment through BinTray. 2019-11-15 08:01:48 -06:00
Christopher Pow e895a2a4dd Compile error in Linux from last changes. 2019-11-14 21:12:07 -06:00
Christopher Pow 399085bd8e Minor goof on last commit. 2019-11-14 20:04:52 -06:00
Christopher Pow b1b835b01e Fixing crash issues on shutdown. 2019-11-14 19:58:39 -06:00
Christopher Pow e0fab989c5 Trying to set qmake in path. 2019-11-13 15:56:45 -06:00
Christopher Pow b37a60130b Trying to set qmake in path. 2019-11-13 15:46:13 -06:00
Christopher Pow b255e353ff Trying to set qmake in path. 2019-11-13 15:26:16 -06:00
Christopher Pow 140c8a499f Adding windows Travis setup. 2019-11-13 15:16:14 -06:00
Christopher Pow a31beb3407 Adding windows Travis setup. 2019-11-13 15:07:01 -06:00
Christopher Pow a6265fc929 Adding windows Travis setup. 2019-11-13 15:06:30 -06:00
Christopher Pow 5d05c76bdb Trying to go to Windows in Travis again. 2019-11-13 13:13:43 -06:00
Christopher Pow bc974dd87b Trying to go to Windows in Travis again. 2019-11-13 13:02:30 -06:00
Christopher Pow c07d5e5501 Merge branch 'master' of https://github.com/christopherpow/nesicide 2019-11-13 12:42:34 -06:00
Christopher Pow 89b35692fb Fix for PPU memory overlap with ROM (mistake in allocator). 2019-11-13 12:42:23 -06:00
Christopher Pow b08ba30a1c Force build 2. 2019-11-12 19:19:08 -06:00
Christopher Pow 9202930944 Force build. 2019-11-12 19:04:14 -06:00
Christopher Pow 912d8342d9 Fix for OSX deploy pathing? 2019-11-12 17:45:06 -06:00
Christopher Pow 23f147b1ff Trying to figure out path issue in Linux. 2019-11-12 12:51:05 -06:00
Christopher Pow b191e71a20 Trying to figure out path issue in Linux. 2019-11-12 12:13:39 -06:00
Christopher Pow 6b75497f38 Fix for Linux CC65 linkage. 2019-11-11 22:06:29 -06:00
Christopher Pow 4a3f9df322 Fix for OSX deploy missing cc65. 2019-11-09 19:33:33 -06:00
Christopher Pow d040b48c5a Update travis for Xcode 11.2. 2019-11-06 08:37:34 -06:00
Trevor Merritt c08c0bbfbd Update README.md
Updates URL for QT download
2019-11-05 16:36:03 -05:00
Christopher Pow 70b5e502cc Merge branch 'master' of https://github.com/christopherpow/nesicide 2019-11-04 09:30:22 -06:00
Christopher Pow 2777f2cc15 Virtual destructor. 2019-11-04 09:30:11 -06:00
Christopher Pow 031509868f Fix for sloc/addr calculation out of bounds. 2019-11-04 09:28:42 -06:00
Christopher Pow 97def918a3 Merge from master. 2019-11-02 19:17:36 -05:00
Christopher Pow c49c7c8728 Merge branch 'master' of github.com:christopherpow/nesicide 2019-11-02 19:05:05 -05:00
Christopher Pow 0b3b188070 Reset proper. 2019-11-02 19:04:56 -05:00
Christopher Pow 61dac3dc6d Fix for APU IRQ? 2019-11-02 14:24:19 -05:00
Christopher Pow 80ea58e768 Resolve merge. 2019-10-30 15:58:07 -05:00
Christopher Pow fd84c3fe51 Updates for latest osx. 2019-10-30 15:57:13 -05:00
Christopher Pow 8008e4e6f2 Fixes for latest Qt. 2019-10-30 13:58:08 -05:00
Christopher Pow 34dec59103 Appveyor. 2019-10-08 10:52:19 -05:00
Christopher Pow 78091204d3 Appveyor. 2019-10-08 10:48:05 -05:00
Christopher Pow 254a1d47f9 Appveyor. 2019-10-08 10:31:42 -05:00
Christopher Pow 841bbb9477 Appveyor. 2019-10-08 10:13:54 -05:00
Christopher Pow 3cf3526c96 Appveyor. 2019-10-08 09:06:14 -05:00
Christopher Pow a22483f227 Appveyor. 2019-10-08 09:03:54 -05:00
Christopher Pow a0f1126abd Debug qscintilla not set properly for Windows. 2019-09-24 13:07:45 -05:00
Christopher Pow acb6cdd249 Merge branch 'master' into reworkemucore 2019-09-20 21:06:27 -05:00
Christopher Pow 34407c9e43 Update SETUP.md 2019-09-20 21:05:30 -05:00
Christopher Pow 331ff1b07b Merge conflict fix. 2019-08-19 20:43:33 -05:00
Christopher Pow ec7987eecb Fix for rc2qt output of dialog item string defaults and posting of date in header of generated output. 2019-08-19 20:40:15 -05:00
Christopher Pow aed6f8587d Fix for MMC1. 2019-08-18 18:03:54 -05:00
Christopher Pow 5e27e24c7d Merge pull request #44 from jimbo1qaz/file-permissions
Mark libs/famitracker/* as non-executable
2019-06-30 20:39:44 -05:00
jimbo1qaz 5f7615db41 Mark libs/famitracker/* as non-executable 2019-06-30 12:16:10 -07:00
Christopher Pow f03bfce077 Fix for rc2qt script generating improper dialog item initializer strings. 2019-06-28 10:49:34 -05:00
Christopher Pow b25344dca1 Merge branch 'master' of github.com:christopherpow/nesicide 2019-06-25 08:19:07 -05:00
Christopher Pow 89313ab766 Remove extra include of cqtmfc.h. 2019-06-25 08:19:02 -05:00
Christopher Pow 3e6aa3b84f Merge branch 'appveyor' 2019-06-25 08:18:40 -05:00
Christopher Pow 220e141bbc Merge pull request #42 from jimbo1qaz/rc2qt-fix-hex-decode
Fix missing hex-decode in rc2qt.py
2019-06-21 22:49:49 -05:00
jimbo1qaz 3bca4ca747 Fix missing hex-decode in rc2qt.py 2019-06-21 20:45:45 -07:00
Christopher Pow 71f4e04eb1 Merge pull request #41 from jimbo1qaz/fix-rc2qt-setup
Fix rc2qt SETUP.md for master changes
2019-06-21 22:40:37 -05:00
jimbo1qaz d44518df47 Fix SETUP.md for master changes 2019-06-21 20:13:52 -07:00
Christopher Pow b3aedbe0d8 Merge branch 'appveyor' 2019-06-21 06:12:56 -05:00
Christopher Pow 9a07129b8c Merge branch 'master' of github.com:christopherpow/nesicide 2019-06-19 16:45:28 -05:00
Christopher Pow d1d816c3f0 More changes for emu core. 2019-04-06 08:34:15 -07:00
Christopher Pow d146f50dbc Updates to emu core. 2019-03-27 21:54:35 -05:00
Christopher Pow afd3c543f4 Starting to rework emu core. 2019-03-10 21:28:26 -05:00
512 changed files with 30293 additions and 11596 deletions
+18 -17
View File
@@ -1,16 +1,13 @@
version: 1.0.{build}
image: Visual Studio 2017
platform: x64
branches:
only:
- appveyor
- master
skip_tags: true
environment:
QTDIR: C:\Qt\5.11\mingw53_32
skip_tags: true
hosts:
phrenetic: 162.243.126.83
@@ -28,15 +25,19 @@ build_script:
bash ./build/windows-deploy.sh local
test: off
deploy_script:
- cmd: >-
bash ./build/windows-deploy.sh remote
# openssl aes-256-cbc -K $encrypted_c3ea658420f4_key -iv $encrypted_c3ea658420f4_iv -in deploy_rsa.enc -out deploy_rsa -d
#
# eval "$(ssh-agent -s)"
#
# chmod 600 deploy_rsa
#
# ssh-add deploy_rsa
#
artifacts:
- path: nesicide-win-x86-*.tar.bz2
name: nesicide
deploy:
- provider: BinTray
username: christopherpow
api_key:
secure: /fEZkCdGFMVIrc9weubw2n9CqZmSW6Ezt44sTtadO4yf+pyCOV2tHR1Fk4FZled3
subject: christopherpow
repo: nesicide
package: nesicide
artifact: nesicide
publish: true
override: true
on:
branch: master
+1 -6
View File
@@ -12,9 +12,7 @@ moc_*
*.moc
qrc_*
*.exe
Makefile.Debug
Makefile
Makefile.Release
**/Makefile*
*/.directory
deps/
compiler/lex.asm.c
@@ -39,6 +37,3 @@ rcParser*
rcVisitor*
rcListener*
/build/nesicide-deps.tar.bz2
/apps/famitracker/Makefile*
/libs/famitracker/Makefile*
+6 -1
View File
@@ -1,16 +1,21 @@
os:
- linux
- osx
osx_image: xcode10.1
osx_image: xcode11.3
dist: xenial
language: cpp
branches:
only:
- master
before_install:
- ./build/spinner.sh start
- travis_wait 60 ./build/${TRAVIS_OS_NAME}-travis-setup.sh before_install
install:
- travis_wait 60 ./build/${TRAVIS_OS_NAME}-travis-setup.sh install
script:
- travis_wait 60 ./build/${TRAVIS_OS_NAME}-build.sh
- travis_wait 60 ./build/${TRAVIS_OS_NAME}-deploy.sh local
- ./build/spinner.sh stop
addons:
ssh_known_hosts: 162.243.126.83
before_deploy:
+1 -1
View File
@@ -1 +1 @@
256
20201111
+38 -16
View File
@@ -2,7 +2,9 @@
nesicide is an Integrated Development Environment (IDE) for the 8-bit Nintendo Entertainment System (NES).
This project contains:
## Products in Project
This project contains the following products:
* NESICIDE (the IDE itself)
* A NES emulator (standalone package of the emulator used in the IDE)
@@ -14,12 +16,19 @@ This project contains:
The following steps are required prior to building this project on any platform.
0. Install `git`
1. Install [Qt 5.6.2](https://download.qt.io/official_releases/qt/5.6/5.6.2/) as it was the latest kit to be verified to build NESICIDE properly with not errors. Please do not use a kit later than this, or if you do, please create a pull request with necessary changes.
1. Install [Qt 5.12.6](http://download.qt.io/archive/qt/5.12/5.12.6/) as it was the latest kit to be verified to build NESICIDE properly without errors. Please do not use a kit later than this, or if you do, please create a pull request with necessary changes.
2. Make sure qmake and your Qt installation is in your PATH.
At the time of writing this Mac OS Homewbrew contains Qt 5.14.1 and NESICIDE can also be built with that version of Qt. So, alternatively, you can install Qt using
```
brew intall qt5
```
### Debian prerequisites
```sh
sudo apt-get install build-essential libasound2-dev liblua5.1-dev libsdl1.2-dev libgl1-mesa-dev wine-dev
sudo apt-get install qtchooser build-essential libasound2-dev liblua5.1-dev libsdl1.2-dev libgl1-mesa-dev
```
### Arch Linux prerequisites
@@ -36,32 +45,45 @@ Install [GnuWin32](https://sourceforge.net/projects/getgnuwin32/) and [wget](htt
This project builds for Linux, macOS, and Windows. To perform a build for any supported platform follow the instructions for the platform below.
> NOTE: The build process takes a while, so grab a snack while you wait. ;)
`NOTE: The build process takes a while, so grab a snack while you wait. ;)`
### Linux
0. `cd build`
1. `./build.sh`
2. Once the build process is complete run: `./linux-deploy.sh`
0. `./build/linux-build.sh`
1. `./build/linux-deploy.sh local`
### macOS
0. `cd build`
1. `./build.sh`
2. Once the build process is complete run: `./osx-deploy.sh`
If you installed Qt from Homebrew you need to set the following environment variable so that the build process can find qmake (the qt5 Homebrew formula is keg-only):
```
PATH="/usr/local/opt/qt/bin:$PATH"
```
0. `./build/osx-build.sh`
1. `./build/osx-deploy.sh local`
### Windows
0. `cd build`
NOTE: The build process uses GnuWin32 tools and MinGW tools. Install these and make sure that `mingw32-make` and `wget` are on your path.
1. `./win-build.sh`
2. Once the build process is complete run: `./win-deploy.sh`
0. `./build/windows-build.sh`
1. `./build/windows-deploy.sh local`
## Running
The `deploy.sh` creates a tarball containing all of the executables and dependent libraries. Extract the tarball to your location of choice and execute.
The `deploy.sh` creates artifacts of the following form.
### Linux
Separate AppImage executables for each product of the project. See https://appimage.org/ for information on AppImage containers.
### macOS
Separate Apple Disk Images (DMGs) for each product of the project.
### Windows
Monolithic bzipped tarball containing all products of the project, extractable to anywhere.
Enjoy!
+25 -10
View File
@@ -21,27 +21,42 @@
The following items are being tracked here because otherwise they'd be forgotten:
- [x] Add folders to project panel and support loading different file types (headers, etc.)
- [x] Finish Code Editor lexer for syntax highlights.
- [X] Add folders to project panel and support loading different file types (headers, etc.)
- [ ] Finish Code Editor lexer for syntax highlights.
- It's still a bit buggy with highlighting numbers in label references.
- It incorrectly comment-highlights ;'s in "'s.
- Comic Sans font in C file comments is ridiculous
- [ ] VIM, perhaps.
- [ ] Add operator highlighting to Code Editor lexer.
- [ ] Arbitrary expressions in the Symbol Watch window.
- [ ] Interactive Lua console for debugging.
- [x] Figure out why Code Browser doesn't snap to reset vector when project is loaded at application startup, but does when project is loaded after startup.
- [ ] Make clean does not remove .nes or .chr files.
- [ ] Add icons to source navigator and add files to list from project so that files can be shown whether or not they are in the list because they were in the project
or because they were pulled in by the build.
- [x] Figure out how to adjust lines of errors, breakpoints, and symbol lookups...probably have to do background compilation.
(This is done because the IDE now puts up a message if a file is newer than the running ROM).
- [ ] Figure out how to adjust lines of errors, breakpoints, and symbol lookups...probably have to do background compilation.
- [ ] Extend drag-drop capability to allow adding source files (use specified extensions to check) to a project.
- [x] Project still does not get cleared out properly when a ROM is loaded after a project has been loaded. Saving the "project" overwrites it with crap.
- [x] Execution Visualizer doesn't open file for address that's clicked on and doesn't bring that file to view in the project.
- [x] Somehow tabs aren't being removed from the Window menu.
- [X] Project still does not get cleared out properly when a ROM is loaded after a project has been loaded. Saving the "project" overwrites it with crap.
- [X] Execution Visualizer doesn't open file for address that's clicked on and doesn't bring that file to view in the project.
- [X] Somehow tabs aren't being removed from the Window menu.
- [ ] Add option to automatically assign names of new elements added to a project based on what they are instead of asking all the time.
- [x] Implement "modes" of the UI. "Coding" mode would close all opened debug windows and emulator windows, allowing most screen real-estate for coding. "Debugging". Alternatively this could just be a "remove clutter" button somewhere prominent in the UI that has the same effect.
- [x] Limit symbol watch debug updates to only the symbols in the currently visible tab in the symbol watch window. Makes no sense to update the values of the RAM symbols if the watch tab is selected. Updating of symbols on a non-visible tab can be done in the tab change handler.
- [X] Implement "modes" of the UI. "Coding" mode would close all opened debug windows and emulator windows, allowing most screen real-estate for coding. "Debugging". Alternatively this could just be a "remove clutter" button somewhere prominent in the UI that has the same effect.
- [X] Fix emulator window disappearing on project reload and debug mode switch.
- [X] Limit symbol watch debug updates to only the symbols in the currently visible tab in the symbol watch window. Makes no sense to update the values of the RAM symbols if the watch tab is selected. Updating of symbols on a non-visible tab can be done in the tab change handler.
- [ ] Add OpenGL monospace font for overlays for Execution Visualizer, Code/Data Logger, maybe other viewers, and Emulator [with Lua capabilities?]
- [ ] Rework CCC65Interface object so that it creates Symbol structures containing all of the relevant information for each symbol in easy-to-access means, rather than using individual CCC65Interface methods to retrieve different pieces of information about symbols all the time. The symbol structures can be built whenever a debug file is loaded, which is either when a project is loaded or when a compile is completed. CCC65Interface::captureDebugInfo.
- [ ] Move linker config file into Project Browser folder. Project Properties can still specify the linker config file name, perhaps, but should not contain the linker config file content.
## NESICIDE UX NOTES FROM GGJ2020
- [ ] Make mixed-mode checkbox accessible via keyboard shortcut, toolbar item, or etc.
- [ ] Mixed-mode assembly in side-bar
- [ ] Mixed-mode assembly updates in real-time (requires background quiet compilation)
- [ ] Attribute Table and Tile/Stamp data should *not* be in project file as they are thus inaccessible to the project source to reference
- [ ] Editors should be detachable
- [X] Some glitches in long term use, probably related to OpenGL misuse. Find an OpenGL debugger?
This included some weird switching of contexts from one widget to another, such as from exevis to emu, etc.
- [X] Should have option to set both start/end of execution visualization markers with one command
- [X] Should have option to remove ALL breakpoints
- [ ] Removing execution visualizer markers by line(s) of selected code only, not just ALL
- [ ] Alpha-blend of execution markers on visual instead of replace
- [X] Fix linker config file browser -- shouldn't be looking to SAVE a file
Regular → Executable
+12 -9
View File
@@ -10,11 +10,15 @@ greaterThan(QT_MAJOR_VERSION,4) {
QT += widgets
}
greaterThan(QT_MAJOR_VERSION,5) {
QT += core5compat
}
TOP = ../..
macx {
QMAKE_MAC_SDK = macosx10.14
}
#macx {
# QMAKE_MAC_SDK = macosx10.16
#}
CONFIG(release, debug|release) {
DESTDIR = release
@@ -55,12 +59,11 @@ FAMITRACKER_CXXFLAGS = -I$$TOP/libs/famitracker
RTMIDI_LIBS = -L$$DEPENDENCYROOTPATH/rtmidi/$$DESTDIR -lrtmidi
win32 {
# contains(QT_ARCH, i386) {
# arch = x86
# } else {
# arch = x64
# }
arch = x86
contains(QT_ARCH, i386) {
arch = x86
} else {
arch = x64
}
SDL_CXXFLAGS = -I$$DEPENDENCYPATH/SDL
SDL_LIBS = -L$$DEPENDENCYPATH/SDL/$$arch -lsdl
+14 -11
View File
@@ -11,11 +11,15 @@ greaterThan(QT_MAJOR_VERSION,4) {
QT += widgets
}
greaterThan(QT_MAJOR_VERSION,5) {
QT += core5compat
}
TOP = ../..
macx {
QMAKE_MAC_SDK = macosx10.14
}
#macx {
# QMAKE_MAC_SDK = macosx10.16
#}
CONFIG(release, debug|release) {
DESTDIR = release
@@ -57,12 +61,11 @@ RTMIDI_LIBS = -L$$DEPENDENCYROOTPATH/rtmidi/$$DESTDIR -lrtmidi
# fixme duplication (https://wiki.qt.io/Including_.pro_Files)
win32 {
# contains(QT_ARCH, i386) {
# arch = x86
# } else {
# arch = x64
# }
arch = x86
contains(QT_ARCH, i386) {
arch = x86
} else {
arch = x64
}
SDL_CXXFLAGS = -I$$DEPENDENCYPATH/SDL
SDL_LIBS = -L$$DEPENDENCYPATH/SDL/$$arch -lsdl
@@ -135,8 +138,8 @@ LIBS += $$FAMITRACKER_LIBS \
$$RTMIDI_LIBS
unix {
QMAKE_CFLAGS += -I $$DEPENDENCYROOTPATH/wine/include -DWINE_UNICODE_NATIVE
QMAKE_CXXFLAGS += -I $$DEPENDENCYROOTPATH/wine/include -DWINE_UNICODE_NATIVE
QMAKE_CFLAGS += -I $$DEPENDENCYROOTPATH/wine/include -DWINE_UNICODE_NATIVE
QMAKE_CXXFLAGS += -I $$DEPENDENCYROOTPATH/wine/include -DWINE_UNICODE_NATIVE
}
INCLUDEPATH += \
+1 -1
View File
@@ -27,7 +27,7 @@ private:
Ui::MainWindow *ui;
bool _initialized;
private slots:
public slots:
void addToolBarWidget(QToolBar* toolBar);
void removeToolBarWidget(QToolBar* toolBar);
void editor_modificationChanged(bool m);
+8
View File
@@ -0,0 +1,8 @@
<RCC>
<qresource prefix="/">
<file>addons/NES/FamiTone2/Source Code/famitone2.inc</file>
<file>addons/NES/FamiTone2/README.HTM</file>
<file>addons/NES/FamiTone2/Source Code/famitone2.s_includeInBuild</file>
<file>addons/NES/FamiTone2/Custom Rules/famitone2.mk</file>
</qresource>
</RCC>
@@ -0,0 +1,18 @@
FTMSOURCES = $(shell find $(OBJDIR) -name *.ftxt)
FTMOBJECTS = $(FTMSOURCES:%.ftxt=%.o)
# Find exported FTMs
vpath %ftxt $(foreach ftxt,$(FTMSOURCES),$(dir $ftxt))
# Add FamiTone2 sources to project make rules
SOURCES += $(FTMSOURCES)
OBJECTS += $(FTMOBJECTS)
# Build a FamiTone2 object file
%.o : %.ftxt
text2data -ca65 $^
$(ASSEMBLE) $(ASFLAGS) -o $@ $(^:%.ftxt=%.s)
# Add FamiTone2 debris to project clean rules
REMOVES += $(FTMSOURCES) $(FTMSOURCES:%.ftxt=%.s)
REMOVES += $(OBJDIR)/famitone2.o
@@ -0,0 +1,22 @@
<?xml version='1.0' encoding='UTF-8'?>
<nesicideprojectaddon target="nes" version="0.3">
<project>
<primitives>
<attributetables/>
<tiles/>
</primitives>
<sources>
<source path="famitone2.s" name="famitone2.s">
<properties includeinbuild="0"/>
</source>
<source path="famitone2.inc" name="famitone2.inc">
<properties includeinbuild="1"/>
</source>
</sources>
<binaryfiles/>
<graphicsbanks/>
<sounds>
<musics/>
</sounds>
</project>
</nesicideprojectaddon>
+5
View File
@@ -0,0 +1,5 @@
<h2>FamiTone2</h2>
This add-on provides NES assembly language routines for playing FamiTracker music and sound effects in your project.
<h3>Files:</h3>
famitone2.s<br>
famitone2.inc
@@ -0,0 +1,10 @@
;this CA65 file automatically reserves RAM for FamiTone2 variables and includes the code
.segment "ZEROPAGE"
FT_TEMP: .res FT_TEMP_SIZE
.segment "FAMITONE"
FT_BASE_ADR: .res FT_BASE_SIZE
.segment "CODE"
.include "famitone2.s"
File diff suppressed because it is too large Load Diff
+2
View File
@@ -1,5 +1,7 @@
#include "appsettings.h"
AppSettings *AppSettings::_instance = NULL;
void AppSettings::setAppMode(AppMode mode)
{
m_appMode = mode;
+13 -2
View File
@@ -7,7 +7,14 @@ class AppSettings : public QObject
{
Q_OBJECT
public:
AppSettings(QObject* parent = 0) : QObject(parent) {};
static AppSettings *instance()
{
if ( !_instance )
{
_instance = new AppSettings();
}
return _instance;
}
virtual ~AppSettings() {};
// Accessors
@@ -24,7 +31,11 @@ public:
protected:
// Settings data structures.
AppMode m_appMode;
private:
static AppSettings *_instance;
AppSettings(QObject* parent = 0) : QObject(parent) {};
signals:
void appSettingsChanged();
};
@@ -2,7 +2,6 @@
#include "ccc65interface.h"
#include "cnesicideproject.h"
#include "main.h"
CMachineImageBuilder::CMachineImageBuilder()
{
@@ -15,9 +14,9 @@ void CMachineImageBuilder::clean()
buildTextLogger->erase();
buildTextLogger->write("<b>Project build started.</b>");
if ( (CCC65Interface::getCLanguageSourcesFromProject().count()) ||
(CCC65Interface::getAssemblerSourcesFromProject().count()) ||
(CCC65Interface::getCustomSourcesFromProject().count()) )
if ( (CCC65Interface::instance()->getCLanguageSourcesFromProject().count()) ||
(CCC65Interface::instance()->getAssemblerSourcesFromProject().count()) ||
(CCC65Interface::instance()->getCustomSourcesFromProject().count()) )
{
sourceAssembler.clean();
}
@@ -37,11 +36,11 @@ bool CMachineImageBuilder::build()
buildTextLogger->erase();
buildTextLogger->write("<b>Project build started.</b>");
if ( (CCC65Interface::getCLanguageSourcesFromProject().count()) ||
(CCC65Interface::getAssemblerSourcesFromProject().count()) ||
(CCC65Interface::getCustomSourcesFromProject().count()) )
if ( (CCC65Interface::instance()->getCLanguageSourcesFromProject().count()) ||
(CCC65Interface::instance()->getAssemblerSourcesFromProject().count()) ||
(CCC65Interface::instance()->getCustomSourcesFromProject().count()) )
{
if ( !nesicideProject->getLinkerConfigFile().isEmpty() )
if ( !CNesicideProject::instance()->getLinkerConfigFile().isEmpty() )
{
ok = sourceAssembler.assemble();
if ( !ok )
+8 -10
View File
@@ -3,12 +3,10 @@
#include "ccc65interface.h"
#include "nes_emulator_core.h"
#include "c64_emulator_core.h"
#include "cobjectregistry.h"
#include "main.h"
C64EmulatorControl::C64EmulatorControl(QWidget *parent) :
QWidget(parent),
ui(new Ui::C64EmulatorControl),
@@ -16,8 +14,8 @@ C64EmulatorControl::C64EmulatorControl(QWidget *parent) :
{
ui->setupUi(this);
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject::connect(breakpointWatcher, SIGNAL(breakpointHit()), this, SLOT(internalPause()));
QObject::connect(emulator, SIGNAL(emulatorPaused(bool)), this, SLOT(internalPause()));
@@ -98,7 +96,7 @@ void C64EmulatorControl::internalPause()
void C64EmulatorControl::on_playButton_clicked()
{
CCC65Interface::isBuildUpToDate();
CCC65Interface::instance()->isBuildUpToDate();
emit startEmulation();
}
@@ -110,28 +108,28 @@ void C64EmulatorControl::on_pauseButton_clicked()
void C64EmulatorControl::on_stepCPUButton_clicked()
{
CCC65Interface::isBuildUpToDate();
CCC65Interface::instance()->isBuildUpToDate();
emit stepCPUEmulation();
}
void C64EmulatorControl::on_resetButton_clicked()
{
CCC65Interface::isBuildUpToDate();
CCC65Interface::instance()->isBuildUpToDate();
emit resetEmulator();
}
void C64EmulatorControl::on_stepOverButton_clicked()
{
CCC65Interface::isBuildUpToDate();
CCC65Interface::instance()->isBuildUpToDate();
emit stepOverCPUEmulation();
}
void C64EmulatorControl::on_stepOutButton_clicked()
{
CCC65Interface::isBuildUpToDate();
CCC65Interface::instance()->isBuildUpToDate();
emit stepOutCPUEmulation();
}
+17 -15
View File
@@ -29,12 +29,14 @@
#include "emulatorprefsdialog.h"
#include "cobjectregistry.h"
#include "breakpointwatcherthread.h"
#include "main.h"
#include "cnesicideproject.h"
#include "cbuildertextlogger.h"
static void breakpointHook ( void )
{
// Tell the world.
C64EmulatorThread* emulator = dynamic_cast<C64EmulatorThread*>(CObjectRegistry::getObject("Emulator"));
C64EmulatorThread* emulator = dynamic_cast<C64EmulatorThread*>(CObjectRegistry::instance()->getObject("Emulator"));
emulator->_breakpointHook();
}
@@ -59,7 +61,7 @@ C64EmulatorThread::C64EmulatorThread(QObject*)
// Enable breakpoint callbacks from the external emulator library.
c64SetBreakpointHook(breakpointHook);
BreakpointWatcherThread* breakpointWatcher = dynamic_cast<BreakpointWatcherThread*>(CObjectRegistry::getObject("Breakpoint Watcher"));
BreakpointWatcherThread* breakpointWatcher = dynamic_cast<BreakpointWatcherThread*>(CObjectRegistry::instance()->getObject("Breakpoint Watcher"));
QObject::connect(this,SIGNAL(breakpoint()),breakpointWatcher,SLOT(breakpoint()));
m_requestMutex = new QMutex();
@@ -214,10 +216,10 @@ void C64EmulatorThread::resetEmulator()
// Force hard-reset of the machine...
c64EnableBreakpoints(false);
if ( nesicideProject->isInitialized() )
if ( CNesicideProject::instance()->isInitialized() )
{
QDir dirProject(nesicideProject->getProjectOutputBasePath());
QString fileName = dirProject.toNativeSeparators(dirProject.absoluteFilePath(nesicideProject->getProjectLinkerOutputName()));
QDir dirProject(CNesicideProject::instance()->getProjectOutputBasePath());
QString fileName = dirProject.toNativeSeparators(dirProject.absoluteFilePath(CNesicideProject::instance()->getProjectLinkerOutputName()));
QString request;
int addr;
qDebug("C64EmulatorThread::resetEmulator ...%s...\n",fileName.toLatin1().data());
@@ -225,7 +227,7 @@ void C64EmulatorThread::resetEmulator()
if ( fileName.endsWith(".c64",Qt::CaseInsensitive) ||
fileName.endsWith(".prg",Qt::CaseInsensitive) )
{
addr = CCC65Interface::getSegmentBase("STARTUP");
addr = CCC65Interface::instance()->getSegmentBase("STARTUP");
lockRequestQueue();
clearRequestQueue();
@@ -285,15 +287,15 @@ void C64EmulatorThread::stepCPUEmulation ()
// Check if we have an end address to stop at from a debug information file.
// If we do, it'll be the valid end of a C statement or an assembly instruction.
addr = c64GetCPURegister(CPU_PC);
absAddr = c64GetAbsoluteAddressFromAddress(addr);
endAddr = CCC65Interface::getEndAddressFromAbsoluteAddress(addr,absAddr);
absAddr = c64GetPhysicalAddressFromAddress(addr);
endAddr = CCC65Interface::instance()->getEndAddressFromPhysicalAddress(addr,absAddr);
if ( endAddr != 0xFFFFFFFF )
{
// Find the last opcode in the C-statement.
for ( ; endAddr > absAddr; endAddr-- )
{
if ( CCC65Interface::isAbsoluteAddressAnOpcode(endAddr) )
if ( CCC65Interface::instance()->isPhysicalAddressAnOpcode(endAddr) )
{
break;
}
@@ -346,8 +348,8 @@ void C64EmulatorThread::stepOverCPUEmulation ()
// Check if we have an end address to stop at from a debug information file.
// If we do, it'll be the valid end of a C statement or an assembly instruction.
addr = c64GetCPURegister(CPU_PC);
absAddr = c64GetAbsoluteAddressFromAddress(addr);
endAddr = CCC65Interface::getEndAddressFromAbsoluteAddress(addr,absAddr);
absAddr = c64GetPhysicalAddressFromAddress(addr);
endAddr = CCC65Interface::instance()->getEndAddressFromPhysicalAddress(addr,absAddr);
if ( endAddr != 0xFFFFFFFF )
{
@@ -357,8 +359,8 @@ void C64EmulatorThread::stepOverCPUEmulation ()
// Check if last instruction on line is JSR...
// This is fairly typical of if conditions with function calls on the same line.
instr = c64GetMemory(endAddr-2);
instAbsAddr = c64GetAbsoluteAddressFromAddress(endAddr-2);
isInstr = CCC65Interface::isAbsoluteAddressAnOpcode(instAbsAddr);
instAbsAddr = c64GetPhysicalAddressFromAddress(endAddr-2);
isInstr = CCC65Interface::instance()->isPhysicalAddressAnOpcode(instAbsAddr);
if ( !isInstr )
{
instr = c64GetMemory(addr);
@@ -634,7 +636,7 @@ void C64EmulatorThread::processResponses(QStringList requests,QStringList respon
// Update opcode masks to show proper disassembly...
for ( a = 0; a < MEM_64KB; a++ )
{
if ( CCC65Interface::isAbsoluteAddressAnOpcode(a) )
if ( CCC65Interface::instance()->isPhysicalAddressAnOpcode(a) )
{
c64SetOpcodeMask(a,1);
}
+42 -6
View File
@@ -1,15 +1,25 @@
#include "cdockwidgetregistry.h"
QHash<QString,CDockWidgetRegistry::CDockWidgetManager*> CDockWidgetRegistry::widgets;
#include <QSettings>
CDockWidgetRegistry *CDockWidgetRegistry::_instance = NULL;
CDockWidgetRegistry::CDockWidgetRegistry()
{
mutex = new QMutex(QMutex::NonRecursive);
}
QWidget* CDockWidgetRegistry::getWidget(const QString& name)
{
QWidget* widget = NULL;
mutex->lock();
if ( widgets.contains(name) )
{
return widgets[name]->widget;
widget = widgets[name]->widget;
}
mutex->unlock();
return 0;
return widget;
}
void CDockWidgetRegistry::addWidget(const QString& name, QWidget* widget, bool visible, bool permanent)
@@ -20,18 +30,23 @@ void CDockWidgetRegistry::addWidget(const QString& name, QWidget* widget, bool v
pDockWidgetManager->enabled = false;
pDockWidgetManager->permanent = permanent;
mutex->lock();
widgets.insert ( name, pDockWidgetManager );
mutex->unlock();
}
void CDockWidgetRegistry::removeWidget(const QString &name)
{
mutex->lock();
widgets.remove(name);
mutex->unlock();
}
void CDockWidgetRegistry::hideAll()
{
QHash<QString,CDockWidgetManager*>::const_iterator i;
mutex->lock();
for (i = widgets.begin(); i != widgets.end(); ++i)
{
if ( !i.value()->permanent )
@@ -40,32 +55,53 @@ void CDockWidgetRegistry::hideAll()
i.value()->visible = false;
}
}
mutex->unlock();
}
void CDockWidgetRegistry::saveVisibility()
{
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE");
mutex->lock();
QHash<QString,CDockWidgetManager*>::const_iterator i;
for (i = widgets.begin(); i != widgets.end(); ++i)
{
i.value()->visible = i.value()->widget->isVisible();
settings.setValue(i.value()->widget->objectName(),i.value()->widget->isVisible());
}
mutex->unlock();
}
void CDockWidgetRegistry::restoreVisibility()
{
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE");
mutex->lock();
QHash<QString,CDockWidgetManager*>::const_iterator i;
for (i = widgets.begin(); i != widgets.end(); ++i)
{
if ( i.value()->visible )
if ( settings.value(i.value()->widget->objectName()).toBool() )
{
// Widget show routines may try to access dock widget registry, so let them.
mutex->unlock();
i.value()->widget->show();
mutex->lock();
}
}
mutex->unlock();
}
bool CDockWidgetRegistry::visible(const QString& name)
{
return widgets.find(name).value()->visible;
bool visible = false;
mutex->lock();
visible = widgets.find(name).value()->visible;
mutex->unlock();
return visible;
}
+20 -9
View File
@@ -4,10 +4,20 @@
#include <QHash>
#include <QString>
#include <QDockWidget>
#include <QMutex>
class CDockWidgetRegistry
{
public:
static CDockWidgetRegistry *_instance;
static CDockWidgetRegistry *instance()
{
if ( !_instance )
{
_instance = new CDockWidgetRegistry();
}
return _instance;
}
typedef struct
{
QWidget* widget;
@@ -15,20 +25,21 @@ public:
bool enabled;
bool permanent;
} CDockWidgetManager;
CDockWidgetRegistry() {};
static QWidget* getWidget(const QString& name);
static void addWidget(const QString& name,
QWidget* getWidget(const QString& name);
void addWidget(const QString& name,
QWidget* widget,
bool visible = false,
bool permanent = false);
static void removeWidget(const QString& name);
static void hideAll();
static void saveVisibility();
static bool visible(const QString& name);
static void restoreVisibility();
void removeWidget(const QString& name);
void hideAll();
void saveVisibility();
bool visible(const QString& name);
void restoreVisibility();
private:
static QHash<QString,CDockWidgetManager*> widgets;
CDockWidgetRegistry();
QHash<QString,CDockWidgetManager*> widgets;
QMutex *mutex;
};
#endif // CDOCKWIDGETREGISTRY_H
+155 -44
View File
@@ -4,7 +4,10 @@
#include "cdockwidgetregistry.h"
#include "ccc65interface.h"
#include "main.h"
#include "cprojecttreeopenaction.h"
#include "model/projectsearcher.h"
#include "environmentsettingsdialog.h"
#include <QToolButton>
@@ -13,6 +16,12 @@ CProjectTabWidget::CProjectTabWidget(QWidget *parent) :
{
tabBar()->installEventFilter(this);
tabBar()->setMouseTracking(true);
tabBar()->setVisible(EnvironmentSettingsDialog::useTabBarInEditorArea());
}
void CProjectTabWidget::setProjectModel(CProjectModel *model)
{
m_pProjectModel = model;
}
bool CProjectTabWidget::eventFilter(QObject *object, QEvent *event)
@@ -48,11 +57,11 @@ void CProjectTabWidget::tabBar_contextMenuEvent(QContextMenuEvent *event)
QMenu menu;
QString addToProjectText = "Add to ";
addToProjectText += nesicideProject->getProjectTitle();
addToProjectText += CNesicideProject::instance()->getProjectTitle();
addToProjectText += " project...";
QString removeFromProjectText = "Remove from ";
removeFromProjectText += nesicideProject->getProjectTitle();
removeFromProjectText += CNesicideProject::instance()->getProjectTitle();
removeFromProjectText += " project...";
QStringList extensions;
@@ -81,7 +90,7 @@ void CProjectTabWidget::tabBar_contextMenuEvent(QContextMenuEvent *event)
{
if ( fileName.endsWith(ext,Qt::CaseInsensitive) )
{
nesicideProject->getProject()->getSources()->addSourceFile(fileName);
CNesicideProject::instance()->getProject()->getSources()->addSourceFile(fileName);
break;
}
}
@@ -91,10 +100,10 @@ void CProjectTabWidget::tabBar_contextMenuEvent(QContextMenuEvent *event)
}
}
int CProjectTabWidget::addTab(QWidget *widget, const QIcon &/*icon*/, const QString &label)
int CProjectTabWidget::addTab(QWidget *page, const QIcon &icon, const QString &label)
{
CDesignerEditorBase* editor = dynamic_cast<CDesignerEditorBase*>(widget);
QDockWidget* codeBrowser = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Assembly Browser"));
CDesignerEditorBase* editor = dynamic_cast<CDesignerEditorBase*>(page);
QDockWidget* codeBrowser = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Assembly Browser"));
QIcon myIcon;
int tabIdx;
@@ -105,6 +114,8 @@ int CProjectTabWidget::addTab(QWidget *widget, const QIcon &/*icon*/, const QStr
QObject::connect(editor,SIGNAL(markProjectDirty(bool)),this,SLOT(projectDirtied(bool)));
QObject::connect(editor,SIGNAL(snapToTab(QString)),this,SLOT(snapToTab(QString)));
QObject::connect(editor,SIGNAL(applyChanges(QString)),this,SLOT(applyChanges(QString)));
QObject::connect(m_pProjectModel,SIGNAL(itemRemoved(QUuid)),editor,SLOT(itemRemoved(QUuid)));
QObject::connect(m_pProjectModel,SIGNAL(itemAdded(QUuid)),editor,SLOT(itemAdded(QUuid)));
QObject::connect(this,SIGNAL(snapTo(QString)),editor,SLOT(snapTo(QString)));
QObject::connect(this,SIGNAL(applyChangesToTab(QString)),editor,SLOT(applyChangesToTab(QString)));
QObject::connect(this,SIGNAL(applyProjectPropertiesToTab()),editor,SLOT(applyProjectPropertiesToTab()));
@@ -119,15 +130,23 @@ int CProjectTabWidget::addTab(QWidget *widget, const QIcon &/*icon*/, const QStr
QObject::connect(this,SIGNAL(updateTargetMachine(QString)),editor,SLOT(updateTargetMachine(QString)));
}
if ( editor && editor->treeLink() )
{
myIcon = editor->treeLink()->icon();
}
else
{
myIcon = QIcon(":/resources/add_file.png");
}
tabIdx = QTabWidget::addTab(widget,myIcon,label);
myIcon = icon;
// Having a custom icon causes unnecessary and weird text eliding.
// if ( editor && editor->treeLink() )
// {
// myIcon = editor->treeLink()->icon();
// }
// else
// {
// myIcon = QIcon(":/resources/icons8-file.png");
// }
tabIdx = QTabWidget::addTab(page,myIcon,label);
// QToolButton *pButton = new QToolButton();
// pButton->setObjectName(label);
// pButton->setMaximumSize(16,16);
// pButton->setIcon(QIcon(":/resources/icons8-pin.png"));
// QObject::connect(pButton,SIGNAL(pressed()),this,SLOT(unDockTab()));
// tabBar()->setTabButton(tabIdx,QTabBar::RightSide,pButton);
// QToolButton* closeButton = new QToolButton;
// QStyle* closeButtonStyle = closeButton->style();
@@ -142,9 +161,48 @@ int CProjectTabWidget::addTab(QWidget *widget, const QIcon &/*icon*/, const QStr
return tabIdx;
}
int CProjectTabWidget::addTab(QWidget *widget, const QString &label)
void CProjectTabWidget::unDockTab()
{
return addTab(widget,QIcon(),label);
// QToolButton *pButton = dynamic_cast<QToolButton*>(sender());
// QString name = pButton->objectName();
// int tab;
// for ( tab = 0; tab < count(); tab++ )
// {
// if ( tabBar()->tabText(tab) == name )
// {
// QWidget *detach = new QWidget(nullptr);
// detach->setWindowTitle(name);
// detach->setGeometry(widget(tab)->geometry());
// blockSignals(true);
// QGridLayout *layout = new QGridLayout();
// layout->addWidget(widget(tab));
// detach->setLayout(layout);
// blockSignals(false);
// detach->show();
// tearOffs.insert(name,detach);
// break;
// }
// }
}
void CProjectTabWidget::reDockTab()
{
// QWidget *attach = dynamic_cast<QWidget*>(sender());
// if ( attach )
// {
// tearOffs.remove(attach->windowTitle());
// blockSignals(true);
// int tab = addTab(attach,attach->windowTitle());
// blockSignals(false);
// attach->close();
// attach->deleteLater();
// }
}
int CProjectTabWidget::addTab(QWidget *page, const QString &label)
{
return addTab(page,QIcon(),label);
}
void CProjectTabWidget::removeTab(int index)
@@ -192,9 +250,9 @@ void CProjectTabWidget::snapToTab(QString item)
QStringList splits;
uint32_t addr;
uint32_t absAddr;
IProjectTreeViewItemIterator iter;
IProjectTreeViewItem* treeItem;
CSourceItem* pSource;
QList<CSourceItem*> sources = ProjectSearcher::findItemsOfType<CSourceItem>(CNesicideProject::instance());
QList<CGraphicsBank*> gfxBanks = ProjectSearcher::findItemsOfType<CGraphicsBank>(CNesicideProject::instance());
QList<CTileStamp*> tileStamps = ProjectSearcher::findItemsOfType<CTileStamp>(CNesicideProject::instance());
bool found = false;
bool open = false;
QDir dir;
@@ -206,6 +264,7 @@ void CProjectTabWidget::snapToTab(QString item)
QString symbol;
CDesignerEditorBase* editor = NULL;
qDebug(item.toUtf8().data());
// Make sure item is something we care about
if ( item.startsWith("Address,") )
{
@@ -225,17 +284,17 @@ void CProjectTabWidget::snapToTab(QString item)
addr = splits.at(3).toInt(NULL,16);
absAddr = (splits.at(1).toInt(NULL,16)*MEM_8KB)+splits.at(2).toInt(NULL,16);
}
file = CCC65Interface::getSourceFileFromAbsoluteAddress(addr,absAddr);
file = QDir::cleanPath(CCC65Interface::instance()->getSourceFileFromPhysicalAddress(addr,absAddr));
}
else if ( item.startsWith("SourceNavigatorFile,") )
{
splits = item.split(QRegExp("[,]"));
file = splits.at(1);
file = QDir::cleanPath(splits.at(1));
}
else if ( item.startsWith("OutputPaneFile,") )
{
splits = item.split(QRegExp("[,]"));
file = splits.at(1);
file = QDir::cleanPath(splits.at(1));
}
else if ( item.startsWith("Tile,") )
{
@@ -256,14 +315,22 @@ void CProjectTabWidget::snapToTab(QString item)
}
}
for ( tab = 0; tab < tearOffs.count(); tab++ )
{
if ( file == tearOffs.keys().at(tab) )
{
tearOffs.values().at(tab)->show();
found = true;
open = true;
break;
}
}
// File is not open, search the project.
if ( !found )
{
treeItem = findProjectItem(uuid);
if ( treeItem )
{
treeItem->openItemEvent(this);
}
CProjectTreeOpenAction action(this, m_pProjectModel);
m_pProjectModel->visitDataItem(uuid, action);
}
}
@@ -280,24 +347,55 @@ void CProjectTabWidget::snapToTab(QString item)
}
}
for ( tab = 0; tab < tearOffs.count(); tab++ )
{
if ( file == tearOffs.keys().at(tab) )
{
tearOffs.values().at(tab)->show();
found = true;
open = true;
break;
}
}
// File is not open, search the project.
if ( !found )
{
iter.reset(nesicideProject->getProject()->getSources());
while ( iter.current() )
foreach ( CSourceItem* source, sources )
{
pSource = dynamic_cast<CSourceItem*>(iter.current());
if ( pSource )
if ( source->path() == file )
{
if ( pSource->path() == file )
{
pSource->openItemEvent(this);
found = true;
open = true;
break;
}
source->openItemEvent(this);
found = true;
open = true;
break;
}
}
}
if ( !found )
{
foreach ( CGraphicsBank* source, gfxBanks )
{
if ( source->caption() == file )
{
source->openItemEvent(this);
found = true;
open = true;
break;
}
}
}
if ( !found )
{
foreach ( CTileStamp* source, tileStamps )
{
if ( source->caption() == file )
{
source->openItemEvent(this);
found = true;
open = true;
break;
}
iter.next();
}
}
@@ -319,7 +417,7 @@ void CProjectTabWidget::snapToTab(QString item)
// Search the source paths...
if ( !found )
{
QStringList sourcePaths = nesicideProject->getSourceSearchPaths();
QStringList sourcePaths = CNesicideProject::instance()->getSourceSearchPaths();
foreach ( QString searchDir, sourcePaths )
{
@@ -337,6 +435,17 @@ void CProjectTabWidget::snapToTab(QString item)
}
}
for ( int tab = 0; tab < tearOffs.count(); tab++ )
{
if ( filePath == tearOffs.keys().at(tab) )
{
tearOffs.values().at(tab)->show();
found = true;
open = true;
break;
}
}
if ( fileIn.exists() )
{
found = true;
@@ -350,12 +459,12 @@ void CProjectTabWidget::snapToTab(QString item)
{
QString str;
str.sprintf("Locate %s...",file.toLatin1().constData());
QString newDir = QFileDialog::getOpenFileName(0,str,QDir::currentPath());
QString newDir = QFileDialog::getOpenFileName(0,str,QDir::currentPath(),QString(),NULL,QFileDialog::DontUseNativeDialog);
if ( !newDir.isEmpty() )
{
QFileInfo fileInfo(newDir);
dir = projectDir.relativeFilePath(fileInfo.path());
nesicideProject->addSourceSearchPath(dir.path());
CNesicideProject::instance()->addSourceSearchPath(dir.path());
filePath = dir.filePath(file);
fileIn.setFileName(filePath);
@@ -413,6 +522,7 @@ void CProjectTabWidget::snapToTab(QString item)
void CProjectTabWidget::applyChanges(QString uuid)
{
qDebug("applyChanges: %s",uuid.toUtf8().data());
emit applyChangesToTab(uuid);
}
@@ -423,6 +533,7 @@ void CProjectTabWidget::applyProjectProperties()
void CProjectTabWidget::applyEnvironmentSettings()
{
tabBar()->setVisible(EnvironmentSettingsDialog::useTabBarInEditorArea());
emit applyEnvironmentSettingsToTab();
}
+14 -3
View File
@@ -4,6 +4,9 @@
#include <QTabWidget>
#include <QDateTime>
#include <QToolBar>
#include <QDockWidget>
#include "model/cprojectmodel.h"
// The IDE uses a system of signals named "snapTo" and "snapToTab" to
// communicate information between various debuggers, IDE elements, or
@@ -35,7 +38,7 @@
// As the snapTo usage is expanded I'll try to remember to document its usage
// and formats here.
//
// snapTo formats: emit snapTo(<string>) where <string is one of:
// snapTo formats: emit snapTo(<string>) where <string> is one of:
// OutputPaneFile,<file>,<line>
// Sent from the output pane in response to the user clicking on a line of
// a search result or an error in a compile log. This tells the other IDE
@@ -71,10 +74,12 @@ class CProjectTabWidget : public QTabWidget
public:
explicit CProjectTabWidget(QWidget *parent = 0);
int addTab(QWidget *widget, const QIcon &icon, const QString &label);
int addTab(QWidget *widget, const QString &label);
int addTab(QWidget *page, const QString &label);
int addTab(QWidget *page, const QIcon &icon, const QString &label);
void removeTab(int index);
void setProjectModel(CProjectModel* model);
protected:
void tabBar_contextMenuEvent(QContextMenuEvent *event);
void tabBar_mouseMoveEvent(QMouseEvent* event);
@@ -100,6 +105,8 @@ signals:
void checkOpenFile(QDateTime lastActivationTime);
public slots:
void unDockTab();
void reDockTab();
void checkOpenFiles(QDateTime lastActivationTime);
void tabModified(bool modified);
void projectDirtied(bool dirtied);
@@ -108,6 +115,10 @@ public slots:
void applyProjectProperties();
void applyEnvironmentSettings();
void applyAppSettings();
protected:
QMap<QString,QWidget*> tearOffs;
CProjectModel *m_pProjectModel;
};
#endif // CPROJECTTABWIDGET_H
+47 -38
View File
@@ -1,56 +1,62 @@
#include "crendererbase.h"
CRendererBase::CRendererBase(int sizeX,int sizeY,int textureSizeXY,int maxZoom,char* imageData,QWidget *parent) :
QGLWidget(parent),
CRendererBase::CRendererBase(int sizeX,int sizeY,int textureSizeXY,int maxZoom,int8_t* imageData,QWidget *parent) :
QOpenGLWidget(parent),
_sizeX(sizeX),
_trueSizeX(textureSizeXY),
_sizeY(sizeY),
_scrollX(0),
_scrollY(0),
_textureSizeXY(textureSizeXY),
_imageData(imageData),
_zoomFactor(100),
_maxZoom(maxZoom)
_maxZoom(maxZoom),
_initialized(false)
{
setBackgroundRole(QPalette::Dark);
setCursor(QCursor(Qt::CrossCursor));
_imageData = imageData;
}
CRendererBase::CRendererBase(int sizeX,int sizeY,int maxZoom,char* imageData,QWidget *parent) :
QGLWidget(parent),
CRendererBase::CRendererBase(int sizeX,int sizeY,int maxZoom,int8_t* imageData,QWidget *parent) :
QOpenGLWidget(parent),
_sizeX(sizeX),
_trueSizeX(sizeX),
_sizeY(sizeY),
_scrollX(0),
_scrollY(0),
_imageData(imageData),
_zoomFactor(100),
_maxZoom(maxZoom)
_maxZoom(maxZoom),
_initialized(false)
{
setBackgroundRole(QPalette::Dark);
setCursor(QCursor(Qt::CrossCursor));
if ( _sizeX > sizeY )
{
_textureSizeXY = _sizeX;
}
else if ( _sizeY > sizeX )
{
_textureSizeXY = _sizeY;
}
else
{
_textureSizeXY = _sizeX;
}
_imageData = imageData;
}
CRendererBase::~CRendererBase()
{
glDeleteTextures(1,(GLuint*)&_textureID);
if ( _initialized )
{
glDeleteTextures(1,(GLuint*)&_textureID);
}
DeleteFunctions();
}
void CRendererBase::initializeGL()
{
QOpenGLWidget::initializeGL();
connect(context(), &QOpenGLContext::aboutToBeDestroyed, this, &CRendererBase::DeleteFunctions);
m_pFunctions = new QOpenGLFunctions();
m_pFunctions->initializeOpenGLFunctions();
if ( _initialized )
{
glDeleteTextures(1,(GLuint*)&_textureID);
}
glGenTextures(1,(GLuint*)&_textureID);
// Enable flat shading
@@ -78,16 +84,14 @@ void CRendererBase::initializeGL()
// Enable textures
glEnable(GL_TEXTURE_2D);
resizeGL(width(),height());
// Create the texture we will be rendering onto
glBindTexture(GL_TEXTURE_2D, _textureID);
// We want it to be RGBA formatted
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
glPixelStorei(GL_PACK_ALIGNMENT, 4);
glPixelStorei(GL_UNPACK_ROW_LENGTH, _textureSizeXY);
glPixelStorei(GL_PACK_ROW_LENGTH, _textureSizeXY);
glPixelStorei(GL_UNPACK_ROW_LENGTH, _trueSizeX);
glPixelStorei(GL_PACK_ROW_LENGTH, _trueSizeX);
// Set our texture parameters
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
@@ -97,10 +101,12 @@ void CRendererBase::initializeGL()
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_DECAL);
// Load the actual texture
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _textureSizeXY, _textureSizeXY, 0, GL_RGBA, GL_UNSIGNED_BYTE, _imageData);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, _sizeX, _sizeY, 0, GL_RGBA, GL_UNSIGNED_BYTE, _imageData);
_initialized = true;
}
void CRendererBase::reloadData(char* imageData)
void CRendererBase::reloadData(int8_t* imageData)
{
_imageData = imageData;
@@ -116,6 +122,8 @@ void CRendererBase::resizeGL(int width, int height)
{
QSize actualSize;
QOpenGLWidget::resizeGL(width,height);
// Force integral scaling factors. TODO: Add to environment settings.
int zf = _zoomFactor / 100;
@@ -148,25 +156,25 @@ void CRendererBase::resizeGL(int width, int height)
glScalef( actualSize.width() / float( width )/_sizeX, actualSize.height() / float( height )/_sizeY, 1 );
// Slightly offset the view to ensure proper pixel alignment
// glTranslatef(0.5,0.5,0);
//glTranslatef(0.5,0.5,0);
}
void CRendererBase::paintGL()
{
float scaleX = (float)_sizeX/(float)_textureSizeXY;
float scaleY = (float)_sizeY/(float)_textureSizeXY;
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
QOpenGLWidget::paintGL();
glBindTexture (GL_TEXTURE_2D, _textureID);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _textureSizeXY, _textureSizeXY, GL_RGBA, GL_UNSIGNED_BYTE, _imageData);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, _sizeX, _sizeY, GL_RGBA, GL_UNSIGNED_BYTE, _imageData);
glBegin(GL_QUADS);
glTexCoord2f (0.0, 0.0);
glVertex3f(000.0f - _scrollX, 000.0f - _scrollY, 0.0f);
glTexCoord2f (scaleX, 0.0);
glTexCoord2f (1.0, 0.0);
glVertex3f(_sizeX - _scrollX, 000.0f - _scrollY, 0.0f);
glTexCoord2f (scaleX, scaleY);
glTexCoord2f (1.0, 1.0);
glVertex3f(_sizeX - _scrollX, _sizeY - _scrollY, 0.0f);
glTexCoord2f (0.0, scaleY);
glTexCoord2f (0.0, 1.0);
glVertex3f(000.0f - _scrollX, _sizeY - _scrollY, 0.0f);
glEnd();
}
@@ -176,6 +184,7 @@ void CRendererBase::changeZoom(int newZoom)
makeCurrent();
_zoomFactor = newZoom;
resizeGL(width(),height());
doneCurrent();
update();
}
+12 -14
View File
@@ -2,41 +2,39 @@
#define CRENDERERBASE_H
#include <QWidget>
#include <QOpenGLWidget>
#include <QOpenGLFunctions>
#include <QMouseEvent>
#include <QGLWidget>
#if defined ( __APPLE__ )
#include <OpenGL/glext.h>
#else
#include <GL/glext.h>
#endif
class CRendererBase : public QGLWidget
class CRendererBase : public QOpenGLWidget
{
Q_OBJECT
public:
CRendererBase(int sizeX,int sizeY,int textureSizeXY,int maxZoom,char* imageData,QWidget *parent = 0);
CRendererBase(int sizeX,int sizeY,int maxZoom,char* imageData,QWidget *parent = 0);
CRendererBase(int sizeX,int sizeY,int textureSizeXY,int maxZoom,int8_t* imageData,QWidget *parent = 0);
CRendererBase(int sizeX,int sizeY,int maxZoom,int8_t* imageData,QWidget *parent = 0);
virtual ~CRendererBase();
void initializeGL();
void resizeGL(int width, int height);
void paintGL();
void changeZoom(int newZoom);
void reloadData(char* imageData);
void reloadData(int8_t* imageData);
void setBGColor(QColor clr);
void setScrollX(int scrollX) { _scrollX = scrollX; }
void setScrollY(int scrollY) { _scrollY = scrollY; }
bool pointToPixel(int ptx,int pty,int* pixx,int* pixy);
public slots:
protected:
void DeleteFunctions() {delete(m_pFunctions); m_pFunctions = nullptr;}
QOpenGLFunctions * m_pFunctions = nullptr;
int _sizeX;
int _trueSizeX;
int _sizeY;
int _scrollX;
int _scrollY;
int _textureSizeXY;
char* _imageData;
bool _initialized;
int8_t* _imageData;
int _zoomFactor;
int _maxZoom;
GLuint _textureID;
+2 -2
View File
@@ -3,7 +3,7 @@
#include "nes_emulator_core.h"
PanZoomRenderer::PanZoomRenderer(int sizeX,int sizeY,int textureSizeXY,int maxZoom,char* imageData,bool showPalette,QWidget *parent) :
PanZoomRenderer::PanZoomRenderer(int sizeX,int sizeY,int textureSizeXY,int maxZoom,int8_t* imageData,bool showPalette,QWidget *parent) :
QWidget(parent),
_sizeX(sizeX),
_sizeY(sizeY),
@@ -19,7 +19,7 @@ PanZoomRenderer::PanZoomRenderer(int sizeX,int sizeY,int textureSizeXY,int maxZo
commonConstructor(showPalette);
}
PanZoomRenderer::PanZoomRenderer(int sizeX,int sizeY,int maxZoom,char* imageData,bool showPalette,QWidget *parent) :
PanZoomRenderer::PanZoomRenderer(int sizeX,int sizeY,int maxZoom,int8_t* imageData,bool showPalette,QWidget *parent) :
QWidget(parent),
_sizeX(sizeX),
_sizeY(sizeY),
+3 -3
View File
@@ -14,11 +14,11 @@ class PanZoomRenderer : public QWidget
{
Q_OBJECT
public:
PanZoomRenderer(int sizeX,int sizeY,int maxZoom,char* imageData,bool showPalette,QWidget *parent = 0);
PanZoomRenderer(int sizeX,int sizeY,int textureSizeXY,int maxZoom,char* imageData,bool showPalette,QWidget *parent = 0);
PanZoomRenderer(int sizeX,int sizeY,int maxZoom,int8_t* imageData,bool showPalette,QWidget *parent = 0);
PanZoomRenderer(int sizeX,int sizeY,int textureSizeXY,int maxZoom,int8_t* imageData,bool showPalette,QWidget *parent = 0);
void commonConstructor(bool showPalette);
virtual ~PanZoomRenderer();
void reloadData(char* imageData) { renderer->reloadData(imageData); }
void reloadData(int8_t* imageData) { renderer->reloadData(imageData); }
QColor getColor(int idx);
void showPalette(bool show);
bool pointToPixel(int ptx,int pty,int* pixx,int* pixy) { return renderer->pointToPixel(ptx,pty,pixx,pixy); }
+50 -23
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
<width>782</width>
<height>312</height>
</rect>
</property>
<property name="mouseTracking">
@@ -19,34 +19,49 @@
<property name="widgetResizable" stdset="0">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<layout class="QGridLayout" name="gridLayout" rowstretch="0,1">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<item row="0" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,0,1,0">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="paletteLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Palette:</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="paletteLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="paletteLabel">
<property name="text">
<string>Palette:</string>
</property>
</widget>
</item>
<item>
<widget class="QtColorPicker" name="col0PushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -65,7 +80,7 @@
<item>
<widget class="QtColorPicker" name="col1PushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -84,7 +99,7 @@
<item>
<widget class="QtColorPicker" name="col2PushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -103,7 +118,7 @@
<item>
<widget class="QtColorPicker" name="col3PushButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -202,8 +217,8 @@
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_3">
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_3" rowstretch="1,0" columnstretch="1,0">
<property name="spacing">
<number>0</number>
</property>
@@ -221,6 +236,9 @@
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="focusPolicy">
<enum>Qt::StrongFocus</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
@@ -231,7 +249,16 @@
<number>1</number>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
+28 -15
View File
@@ -1,26 +1,18 @@
#include "searcherthread.h"
#include "main.h"
#include "cbuildertextlogger.h"
#include "cnesicideproject.h"
SearcherThread::SearcherThread(QObject*)
SearcherWorker::SearcherWorker(QObject*)
{
m_found = 0;
pThread = new QThread();
moveToThread(pThread);
pThread->start();
}
SearcherThread::~SearcherThread()
SearcherWorker::~SearcherWorker()
{
pThread->exit(0);
pThread->wait();
delete pThread;
}
void SearcherThread::search(QDir dir, QString searchText, QString pattern, bool subfolders, bool sourceSearchPaths, bool useRegex, bool caseSensitive)
void SearcherWorker::search(QDir dir, QString searchText, QString pattern, bool subfolders, bool sourceSearchPaths, bool useRegex, bool caseSensitive)
{
m_dir = dir;
m_searchText = searchText;
@@ -34,7 +26,7 @@ void SearcherThread::search(QDir dir, QString searchText, QString pattern, bool
doSearch(m_dir,&m_found);
if ( m_sourceSearchPaths )
{
foreach ( QString searchPath, nesicideProject->getSourceSearchPaths() )
foreach ( QString searchPath, CNesicideProject::instance()->getSourceSearchPaths() )
{
m_dir = searchPath;
doSearch(m_dir,&m_found);
@@ -43,7 +35,7 @@ void SearcherThread::search(QDir dir, QString searchText, QString pattern, bool
emit searchDone(m_found);
}
void SearcherThread::doSearch(QDir dir,int* finds)
void SearcherWorker::doSearch(QDir dir,int* finds)
{
QDir base(QDir::currentPath());
QFileInfoList entries = dir.entryInfoList(QDir::AllDirs|QDir::NoDotAndDotDot|QDir::NoSymLinks|QDir::Files);
@@ -98,3 +90,24 @@ void SearcherThread::doSearch(QDir dir,int* finds)
}
}
}
SearcherThread::SearcherThread(QObject*)
{
pWorker = new SearcherWorker();
QObject::connect(pWorker,SIGNAL(searchDone(int)),this,SIGNAL(searchDone(int)));
pThread = new QThread();
pWorker->moveToThread(pThread);
pThread->start();
}
SearcherThread::~SearcherThread()
{
pThread->exit(0);
pThread->wait();
delete pThread;
delete pWorker;
}
+24 -6
View File
@@ -5,22 +5,19 @@
#include <QDir>
#include <QSemaphore>
class SearcherThread : public QObject
class SearcherWorker : public QObject
{
Q_OBJECT
public:
SearcherThread ( QObject* parent = 0 );
virtual ~SearcherThread ();
SearcherWorker ( QObject* parent = 0 );
virtual ~SearcherWorker ();
public slots:
void search(QDir dir, QString searchText, QString pattern, bool subfolders, bool sourceSearchPaths, bool useRegex, bool caseSensitive);
signals:
void searchDone(int found);
protected:
QThread* pThread;
void doSearch(QDir dir,int* finds);
bool m_isTerminating;
QDir m_dir;
@@ -33,4 +30,25 @@ protected:
int m_found;
};
class SearcherThread : public QObject
{
Q_OBJECT
public:
SearcherThread ( QObject* parent = 0 );
virtual ~SearcherThread ();
public slots:
void search(QDir dir, QString searchText, QString pattern, bool subfolders, bool sourceSearchPaths, bool useRegex, bool caseSensitive)
{
pWorker->search(dir,searchText,pattern,subfolders,sourceSearchPaths,useRegex,caseSensitive);
}
signals:
void searchDone(int found);
protected:
SearcherWorker *pWorker;
QThread *pThread;
};
#endif // SEARCHERTHREAD_H
+6 -3
View File
@@ -3,12 +3,15 @@
#include <QFileDialog>
#include <QCompleter>
#include <QSettings>
#include <QKeyEvent>
#include <QLineEdit>
#include "searcherthread.h"
#include "cobjectregistry.h"
#include "main.h"
#include "cbuildertextlogger.h"
SearchWidget::SearchWidget(QWidget *parent) :
QWidget(parent),
@@ -35,7 +38,7 @@ SearchWidget::SearchWidget(QWidget *parent) :
ui->location->completer()->setCompletionMode(QCompleter::PopupCompletion);
ui->type->completer()->setCompletionMode(QCompleter::PopupCompletion);
QObject* searcher = CObjectRegistry::getObject("Searcher");
QObject* searcher = CObjectRegistry::instance()->getObject("Searcher");
qRegisterMetaType<QDir>("QDir");
QObject::connect(this,SIGNAL(search(QDir,QString,QString,bool,bool,bool,bool)),searcher,SLOT(search(QDir,QString,QString,bool,bool,bool,bool)));
QObject::connect(searcher,SIGNAL(searchDone(int)),this,SLOT(searcher_searchDone(int)));
@@ -95,7 +98,7 @@ void SearchWidget::on_find_clicked()
{
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE");
QStringList items;
SearcherThread* searcher = dynamic_cast<SearcherThread*>(CObjectRegistry::getObject("Searcher"));
SearcherThread* searcher = dynamic_cast<SearcherThread*>(CObjectRegistry::instance()->getObject("Searcher"));
if ( !ui->searchText->currentText().isEmpty() )
{
+73 -38
View File
@@ -6,39 +6,45 @@
<rect>
<x>0</x>
<y>0</y>
<width>559</width>
<height>155</height>
<width>675</width>
<height>235</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>559</width>
<height>155</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>524287</width>
<height>524287</height>
</size>
</property>
<property name="windowTitle">
<string>Search</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="horizontalSpacing">
<number>-1</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Search for:</string>
</property>
@@ -46,6 +52,12 @@
</item>
<item row="0" column="1">
<widget class="QComboBox" name="searchText">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
</property>
@@ -59,6 +71,12 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Search in:</string>
</property>
@@ -69,7 +87,7 @@
<item>
<widget class="QComboBox" name="location">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -97,6 +115,12 @@
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Files of type:</string>
</property>
@@ -104,6 +128,12 @@
</item>
<item row="2" column="1">
<widget class="QComboBox" name="type">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="editable">
<bool>true</bool>
</property>
@@ -116,17 +146,19 @@
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="projectFolder">
<property name="spacing">
<number>-1</number>
</property>
<item row="1" column="3">
<widget class="QPushButton" name="find">
<property name="text">
<string>Limit search to Project folders</string>
<string>Find...</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="subfolders">
<property name="text">
<string>Include Subfolders</string>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
</property>
</widget>
</item>
@@ -144,23 +176,17 @@
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="sourceSearchPaths">
<item row="0" column="0">
<widget class="QCheckBox" name="projectFolder">
<property name="text">
<string>Include Source Search Paths</string>
<string>Limit search to Project folders</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="find">
<item row="0" column="1">
<widget class="QCheckBox" name="subfolders">
<property name="text">
<string>Find...</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="default">
<bool>true</bool>
<string>Include Subfolders</string>
</property>
</widget>
</item>
@@ -177,12 +203,21 @@
</property>
</spacer>
</item>
<item row="0" column="2" colspan="2">
<widget class="QCheckBox" name="sourceSearchPaths">
<property name="text">
<string>Include Source Search Paths</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../../common/resource.qrc"/>
<include location="../../../common/resource.qrc"/>
<include location="../../../common/resource.qrc"/>
</resources>
<connections/>
</ui>
+12 -12
View File
@@ -22,8 +22,8 @@ SourceNavigator::SourceNavigator(QWidget *parent) :
m_loadedTarget = "none";
QObject* compiler = CObjectRegistry::getObject("Compiler");
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* compiler = CObjectRegistry::instance()->getObject("Compiler");
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject::connect(compiler,SIGNAL(compileDone(bool)),this,SLOT(compiler_compileDone(bool)));
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),this,SLOT(emulator_emulatorPaused()));
}
@@ -35,12 +35,12 @@ SourceNavigator::~SourceNavigator()
void SourceNavigator::updateTargetMachine(QString target)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
m_loadedTarget = target;
if ( emulator )
if ( target.compare("none") )
{
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject::connect(emulator,SIGNAL(machineReady()),this,SLOT(emulator_machineReady()));
QObject::connect(emulator,SIGNAL(emulatorPaused(bool)),this,SLOT(emulator_emulatorPaused(bool)));
QObject::connect(emulator,SIGNAL(emulatorReset()),this,SLOT(emulator_emulatorPaused()));
@@ -60,7 +60,7 @@ void SourceNavigator::updateFiles(bool doIt)
ui->files->clear();
ui->symbols->clear();
QStringList files = CCC65Interface::getSourceFiles();
QStringList files = CCC65Interface::instance()->getSourceFiles();
ui->files->addItems(files);
if ( doIt )
@@ -86,7 +86,7 @@ void SourceNavigator::updateSymbolsForFile(QString file)
blockSignals(true);
ui->symbols->clear();
symbols = CCC65Interface::getSymbolsForSourceFile(file);
symbols = CCC65Interface::instance()->getSymbolsForSourceFile(file);
ui->symbols->addItems(symbols);
blockSignals(false);
@@ -111,18 +111,18 @@ void SourceNavigator::emulator_emulatorPaused(bool show)
if ( !m_loadedTarget.compare("nes",Qt::CaseInsensitive) )
{
addr = nesGetCPUProgramCounterOfLastSync();
absAddr = nesGetAbsoluteAddressFromAddress(addr);
absAddr = nesGetPhysicalAddressFromAddress(addr);
}
else if ( !m_loadedTarget.compare("c64",Qt::CaseInsensitive) )
{
addr = c64GetCPURegister(CPU_PC);
absAddr = c64GetAbsoluteAddressFromAddress(addr);
absAddr = c64GetPhysicalAddressFromAddress(addr);
}
file = CCC65Interface::getSourceFileFromAbsoluteAddress(addr,absAddr);
file = CCC65Interface::instance()->getSourceFileFromPhysicalAddress(addr,absAddr);
if ( !file.isEmpty() )
{
linenumber = CCC65Interface::getSourceLineFromAbsoluteAddress(addr,absAddr);
linenumber = CCC65Interface::instance()->getSourceLineFromPhysicalAddress(addr,absAddr);
emit snapTo("SourceNavigatorFile,"+file+","+QString::number(linenumber));
}
}
@@ -142,7 +142,7 @@ void SourceNavigator::on_files_activated(QString file)
void SourceNavigator::on_symbols_activated(QString symbol)
{
QString file = CCC65Interface::getSourceFileFromSymbol(symbol);
QString file = CCC65Interface::instance()->getSourceFileFromSymbol(symbol);
emit snapTo("SourceNavigatorFile,"+file);
emit snapTo("SourceNavigatorSymbol,"+symbol);
}
+254 -149
View File
@@ -5,11 +5,13 @@
#include "dbg_cnes6502.h"
#include "main.h"
#include "model/projectsearcher.h"
cc65_dbginfo CCC65Interface::dbgInfo = NULL;
QStringList CCC65Interface::errors;
QString CCC65Interface::targetMachine = "none";
#include "cbuildertextlogger.h"
#include "environmentsettingsdialog.h"
CCC65Interface *CCC65Interface::_instance = NULL;
// This utility compares two file paths regardless of original slashery.
bool fileNamesAreIdentical(QString file1, QString file2)
@@ -33,7 +35,13 @@ static const char* asmTargetRuleFmt =
;
CCC65Interface::CCC65Interface()
: dbgInfo(NULL),
targetMachine("none"),
process(NULL)
{
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
qRegisterMetaType<QProcess::ProcessState>("QProcess::ProcessState");
}
CCC65Interface::~CCC65Interface()
@@ -54,47 +62,44 @@ void CCC65Interface::clear()
QStringList CCC65Interface::getAssemblerSourcesFromProject()
{
IProjectTreeViewItemIterator iter(nesicideProject->getProject()->getSources());
QDir baseDir(QDir::currentPath());
CSourceItem* source;
QStringList sources;
QStringList extensions = EnvironmentSettingsDialog::sourceExtensionsForAssembly().split(" ", QString::SkipEmptyParts);
QDir baseDir(QDir::currentPath());
QStringList extensions = EnvironmentSettingsDialog::sourceExtensionsForAssembly().split(" ", QString::SkipEmptyParts);
QList<CSourceItem*> projectSources = ProjectSearcher::findItemsOfType<CSourceItem>(CNesicideProject::instance());
QStringList includedSources;
// For each source code object, compile it.
while ( iter.current() )
foreach ( CSourceItem* source, projectSources )
{
source = dynamic_cast<CSourceItem*>(iter.current());
foreach ( QString extension, extensions )
{
if ( source && source->path().endsWith(extension,Qt::CaseInsensitive) )
if ( source->includeInBuild() &&
source->path().endsWith(extension,Qt::CaseInsensitive) )
{
sources.append(baseDir.fromNativeSeparators(baseDir.relativeFilePath(source->path())));
includedSources.append(baseDir.fromNativeSeparators(baseDir.relativeFilePath(source->path())));
}
}
iter.next();
}
return sources;
return includedSources;
}
QStringList CCC65Interface::getCLanguageSourcesFromProject()
{
IProjectTreeViewItemIterator iter(nesicideProject->getProject()->getSources());
QDir baseDir(QDir::currentPath());
CSourceItem* source;
QStringList sources;
QStringList extensions = EnvironmentSettingsDialog::sourceExtensionsForC().split(" ", QString::SkipEmptyParts);
QStringList headerExtensions = EnvironmentSettingsDialog::headerExtensions().split(" ", QString::SkipEmptyParts);
bool add;
QDir baseDir(QDir::currentPath());
QStringList extensions = EnvironmentSettingsDialog::sourceExtensionsForC().split(" ", QString::SkipEmptyParts);
QStringList headerExtensions = EnvironmentSettingsDialog::headerExtensions().split(" ", QString::SkipEmptyParts);
bool add;
QList<CSourceItem*> projectSources = ProjectSearcher::findItemsOfType<CSourceItem>(CNesicideProject::instance());
QStringList includedSources;
// For each source code object, compile it.
while ( iter.current() )
foreach ( CSourceItem* source, projectSources )
{
source = dynamic_cast<CSourceItem*>(iter.current());
add = true;
foreach ( QString extension, extensions )
{
if ( source && source->path().endsWith(extension,Qt::CaseInsensitive) )
if ( source->includeInBuild() &&
source->path().endsWith(extension,Qt::CaseInsensitive) )
{
foreach ( QString headerExtension, headerExtensions )
{
@@ -107,34 +112,32 @@ QStringList CCC65Interface::getCLanguageSourcesFromProject()
if ( add )
{
sources.append(baseDir.fromNativeSeparators(baseDir.relativeFilePath(source->path())));
includedSources.append(baseDir.fromNativeSeparators(baseDir.relativeFilePath(source->path())));
}
}
}
iter.next();
}
return sources;
return includedSources;
}
QStringList CCC65Interface::getCustomSourcesFromProject()
{
IProjectTreeViewItemIterator iter(nesicideProject->getProject()->getSources());
QDir baseDir(QDir::currentPath());
CSourceItem* source;
QStringList sources;
QStringList extensions = EnvironmentSettingsDialog::customExtensions().split(" ", QString::SkipEmptyParts);
QStringList headerExtensions = EnvironmentSettingsDialog::headerExtensions().split(" ", QString::SkipEmptyParts);
bool add;
QDir baseDir(QDir::currentPath());
QStringList extensions = EnvironmentSettingsDialog::customExtensions().split(" ", QString::SkipEmptyParts);
QStringList headerExtensions = EnvironmentSettingsDialog::headerExtensions().split(" ", QString::SkipEmptyParts);
bool add;
QList<CSourceItem*> projectSources = ProjectSearcher::findItemsOfType<CSourceItem>(CNesicideProject::instance());
QStringList includedSources;
// For each source code object, compile it.
while ( iter.current() )
foreach ( CSourceItem* source, projectSources )
{
source = dynamic_cast<CSourceItem*>(iter.current());
add = true;
foreach ( QString extension, extensions )
{
if ( source && source->path().endsWith(extension,Qt::CaseInsensitive) )
if ( source->includeInBuild() &&
source->path().endsWith(extension,Qt::CaseInsensitive) )
{
foreach ( QString headerExtension, headerExtensions )
{
@@ -147,14 +150,13 @@ QStringList CCC65Interface::getCustomSourcesFromProject()
if ( add )
{
sources.append(baseDir.fromNativeSeparators(baseDir.relativeFilePath(source->path())));
includedSources.append(baseDir.fromNativeSeparators(baseDir.relativeFilePath(source->path())));
}
}
}
iter.next();
}
return sources;
return includedSources;
}
bool CCC65Interface::createMakefile()
@@ -199,35 +201,33 @@ bool CCC65Interface::createMakefile()
// Replace stuff that needs to be replaced...
makeFileContent.replace("<!target-machine!>",targetMachine);
makeFileContent.replace("<!project-name!>",nesicideProject->getProjectOutputName());
makeFileContent.replace("<!prg-rom-name!>",nesicideProject->getProjectLinkerOutputName());
makeFileContent.replace("<!linker-config!>",nesicideProject->getLinkerConfigFile());
makeFileContent.replace("<!compiler-flags!>",nesicideProject->getCompilerAdditionalOptions());
makeFileContent.replace("<!compiler-include-paths!>",nesicideProject->getCompilerIncludePaths());
makeFileContent.replace("<!compiler-defines!>",nesicideProject->getCompilerDefinedSymbols());
makeFileContent.replace("<!assembler-flags!>",nesicideProject->getAssemblerAdditionalOptions());
makeFileContent.replace("<!assembler-include-paths!>",nesicideProject->getAssemblerIncludePaths());
makeFileContent.replace("<!assembler-defines!>",nesicideProject->getAssemblerDefinedSymbols());
makeFileContent.replace("<!debug-file!>",nesicideProject->getProjectDebugInfoName());
makeFileContent.replace("<!linker-flags!>",nesicideProject->getLinkerAdditionalOptions());
makeFileContent.replace("<!project-name!>",CNesicideProject::instance()->getProjectOutputName());
makeFileContent.replace("<!prg-rom-name!>",CNesicideProject::instance()->getProjectLinkerOutputName());
makeFileContent.replace("<!linker-config!>",CNesicideProject::instance()->getLinkerConfigFile());
makeFileContent.replace("<!compiler-flags!>",CNesicideProject::instance()->getCompilerAdditionalOptions());
makeFileContent.replace("<!compiler-include-paths!>",CNesicideProject::instance()->getCompilerIncludePaths());
makeFileContent.replace("<!compiler-defines!>",CNesicideProject::instance()->getCompilerDefinedSymbols());
makeFileContent.replace("<!assembler-flags!>",CNesicideProject::instance()->getAssemblerAdditionalOptions());
makeFileContent.replace("<!assembler-include-paths!>",CNesicideProject::instance()->getAssemblerIncludePaths());
makeFileContent.replace("<!assembler-defines!>",CNesicideProject::instance()->getAssemblerDefinedSymbols());
makeFileContent.replace("<!debug-file!>",CNesicideProject::instance()->getProjectDebugInfoName());
makeFileContent.replace("<!linker-flags!>",CNesicideProject::instance()->getLinkerAdditionalOptions());
makeFileContent.replace("<!source-dir!>",QDir::currentPath());
makeFileContent.replace("<!object-dir!>",nesicideProject->getProjectOutputBasePath());
makeFileContent.replace("<!prg-dir!>",nesicideProject->getProjectLinkerOutputBasePath());
makeFileContent.replace("<!chr-dir!>",nesicideProject->getProjectCHRROMOutputBasePath());
makeFileContent.replace("<!object-dir!>",CNesicideProject::instance()->getProjectOutputBasePath());
makeFileContent.replace("<!prg-dir!>",CNesicideProject::instance()->getProjectLinkerOutputBasePath());
makeFileContent.replace("<!chr-dir!>",CNesicideProject::instance()->getProjectCHRROMOutputBasePath());
makeFileContent.replace("<!clang-sources!>",getCLanguageSourcesFromProject().join(" "));
makeFileContent.replace("<!asm-sources!>",getAssemblerSourcesFromProject().join(" "));
makeFileContent.replace("<!custom-sources!>",getCustomSourcesFromProject().join(" "));
makeFileContent.replace("<!target-rules!>",targetRules);
makeFileContent.replace("<!linker-dependencies!>",nesicideProject->getLinkerAdditionalDependencies());
makeFileContent.replace("<!linker-dependencies!>",CNesicideProject::instance()->getLinkerAdditionalDependencies());
if ( !nesicideProject->getMakefileCustomRulesFile().isEmpty() )
QString customRulesFiles;
foreach ( QString customRuleFile,CNesicideProject::instance()->getMakefileCustomRuleFiles() )
{
makeFileContent.replace("<!custom-rules!>",QString("-include ")+nesicideProject->getMakefileCustomRulesFile());
}
else
{
makeFileContent.replace("<!custom-rules!>","");
customRulesFiles += "-include "+customRuleFile+"\r\n";
}
makeFileContent.replace("<!custom-rules!>",customRulesFiles);
// Write the file to disk.
makeFile.write(makeFileContent.toLatin1());
@@ -241,18 +241,106 @@ bool CCC65Interface::createMakefile()
return false;
}
void CCC65Interface::process_errorOccurred(QProcess::ProcessError error)
{
//buildTextLogger->write("<b><font color='gray' style='bold'>ENV::ERROR: "+QString::number(error)+"</font></b>");
}
void CCC65Interface::process_finished(int exitCode, QProcess::ExitStatus exitStatus)
{
QString stdioStr;
QStringList stdioList;
//buildTextLogger->write("<b><font color='gray' style='bold'>ENV::EXIT "+QString::number(exitCode)+", "+QString::number(exitStatus)+"</font></b>");
stdioStr = QString(process.readAllStandardError());
stdioList = stdioStr.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
errors.append(stdioList);
foreach ( const QString& str, stdioList )
{
buildTextLogger->write("<font color='red'>"+str+"</font>");
}
}
void CCC65Interface::process_readyReadStandardError()
{
QString stdioStr;
QStringList stdioList;
if ( process.state() == QProcess::ProcessState::Running )
{
//buildTextLogger->write("<b><font color='gray' style='bold'>ENV::READ STDERR</font></b>");
stdioStr = QString(process.readAllStandardError());
stdioList = stdioStr.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
errors.append(stdioList);
foreach ( const QString& str, stdioList )
{
buildTextLogger->write("<font color='red'>"+str+"</font>");
}
}
}
void CCC65Interface::process_readyReadStandardOutput()
{
QString stdioStr;
QStringList stdioList;
if ( process.state() == QProcess::ProcessState::Running )
{
//buildTextLogger->write("<b><font color='gray' style='bold'>ENV::READ STDOUT</font></b>");
stdioStr = QString(process.readAllStandardOutput());
stdioList = stdioStr.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
foreach ( const QString& str, stdioList )
{
buildTextLogger->write("<font color='blue'>"+str+"</font>");
}
}
}
void CCC65Interface::process_started()
{
QString stdioStr;
QStringList stdioList;
//buildTextLogger->write("<b><font color='gray' style='bold'>ENV::STARTED</font></b>");
stdioStr = QString(process.readAllStandardOutput());
stdioList = stdioStr.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
foreach ( const QString& str, stdioList )
{
buildTextLogger->write("<font color='blue'>"+str+"</font>");
}
}
void CCC65Interface::process_stateChanged(QProcess::ProcessState newState)
{
//buildTextLogger->write("<b><font color='gray' style='bold'>ENV::STATE: "+QString::number(newState)+"</font></b>");
}
void CCC65Interface::clean()
{
QProcess make;
QStringList env = QProcess::systemEnvironment();
QString invocationStr;
QString stdioStr;
QStringList stdioList;
int exitCode;
// Prevent overbuild
protect.lock();
process.moveToThread(QThread::currentThread());
// Copy the system environment to the child process.
make.setEnvironment(env);
make.setWorkingDirectory(QDir::currentPath());
process.setEnvironment(env);
process.setWorkingDirectory(QDir::currentPath());
QObject::connect(&process,SIGNAL(started()),this,SLOT(process_started()));
QObject::connect(&process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(process_finished(int,QProcess::ExitStatus)));
QObject::connect(&process,SIGNAL(errorOccurred(QProcess::ProcessError)),this,SLOT(process_errorOccurred(QProcess::ProcessError)));
QObject::connect(&process,SIGNAL(readyReadStandardError()),this,SLOT(process_readyReadStandardError()));
QObject::connect(&process,SIGNAL(readyReadStandardOutput()),this,SLOT(process_readyReadStandardOutput()));
QObject::connect(&process,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(process_stateChanged(QProcess::ProcessState)));
// Clear the error storage.
errors.clear();
@@ -263,52 +351,55 @@ void CCC65Interface::clean()
buildTextLogger->write(invocationStr);
make.start(invocationStr);
make.waitForFinished();
make.waitForReadyRead();
exitCode = make.exitCode();
stdioStr = QString(make.readAllStandardOutput());
stdioList = stdioStr.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
foreach ( const QString& str, stdioList )
{
buildTextLogger->write("<font color='blue'>"+str+"</font>");
}
stdioStr = QString(make.readAllStandardError());
stdioList = stdioStr.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
errors.append(stdioList);
foreach ( const QString& str, stdioList )
{
buildTextLogger->write("<font color='red'>"+str+"</font>");
}
process.start(invocationStr);
process.waitForFinished();
QObject::disconnect(&process,SIGNAL(started()),this,SLOT(process_started()));
QObject::disconnect(&process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(process_finished(int,QProcess::ExitStatus)));
QObject::disconnect(&process,SIGNAL(errorOccurred(QProcess::ProcessError)),this,SLOT(process_errorOccurred(QProcess::ProcessError)));
QObject::disconnect(&process,SIGNAL(readyReadStandardError()),this,SLOT(process_readyReadStandardError()));
QObject::disconnect(&process,SIGNAL(readyReadStandardOutput()),this,SLOT(process_readyReadStandardOutput()));
QObject::disconnect(&process,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(process_stateChanged(QProcess::ProcessState)));
// Prevent overbuild
protect.unlock();
return;
}
bool CCC65Interface::assemble()
{
QProcess make;
QStringList env = QProcess::systemEnvironment();
QString invocationStr;
QString stdioStr;
QStringList stdioList;
QDir outputDir(nesicideProject->getProjectLinkerOutputBasePath());
QDir outputDir(CNesicideProject::instance()->getProjectLinkerOutputBasePath());
QString outputName;
int exitCode;
bool ok = true;
if ( nesicideProject->getProjectLinkerOutputName().isEmpty() )
// Prevent overbuild
protect.lock();
if ( CNesicideProject::instance()->getProjectLinkerOutputName().isEmpty() )
{
outputName = outputDir.fromNativeSeparators(outputDir.filePath(nesicideProject->getProjectOutputName()+".prg"));
outputName = outputDir.fromNativeSeparators(outputDir.filePath(CNesicideProject::instance()->getProjectOutputName()+".prg"));
}
else
{
outputName = outputDir.fromNativeSeparators(outputDir.filePath(nesicideProject->getProjectLinkerOutputName()));
outputName = outputDir.fromNativeSeparators(outputDir.filePath(CNesicideProject::instance()->getProjectLinkerOutputName()));
}
buildTextLogger->write("<b>Building: "+outputName+"</b>");
// Copy the system environment to the child process.
make.setEnvironment(env);
make.setWorkingDirectory(QDir::currentPath());
process.setEnvironment(env);
process.setWorkingDirectory(QDir::currentPath());
QObject::connect(&process,SIGNAL(started()),this,SLOT(process_started()));
QObject::connect(&process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(process_finished(int,QProcess::ExitStatus)));
QObject::connect(&process,SIGNAL(errorOccurred(QProcess::ProcessError)),this,SLOT(process_errorOccurred(QProcess::ProcessError)));
QObject::connect(&process,SIGNAL(readyReadStandardError()),this,SLOT(process_readyReadStandardError()));
QObject::connect(&process,SIGNAL(readyReadStandardOutput()),this,SLOT(process_readyReadStandardOutput()));
QObject::connect(&process,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(process_stateChanged(QProcess::ProcessState)));
// Clear the error storage.
errors.clear();
@@ -319,28 +410,24 @@ bool CCC65Interface::assemble()
buildTextLogger->write(invocationStr);
make.start(invocationStr);
make.waitForFinished();
make.waitForReadyRead();
exitCode = make.exitCode();
stdioStr = QString(make.readAllStandardOutput());
stdioList = stdioStr.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
foreach ( const QString& str, stdioList )
{
buildTextLogger->write("<font color='blue'>"+str+"</font>");
}
stdioStr = QString(make.readAllStandardError());
stdioList = stdioStr.split(QRegExp("[\r\n]"),QString::SkipEmptyParts);
errors.append(stdioList);
foreach ( const QString& str, stdioList )
{
buildTextLogger->write("<font color='red'>"+str+"</font>");
}
process.start(invocationStr);
process.waitForFinished();
exitCode = process.exitCode();
if ( exitCode )
{
ok = false;
}
QObject::disconnect(&process,SIGNAL(started()),this,SLOT(process_started()));
QObject::disconnect(&process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(process_finished(int,QProcess::ExitStatus)));
QObject::disconnect(&process,SIGNAL(errorOccurred(QProcess::ProcessError)),this,SLOT(process_errorOccurred(QProcess::ProcessError)));
QObject::disconnect(&process,SIGNAL(readyReadStandardError()),this,SLOT(process_readyReadStandardError()));
QObject::disconnect(&process,SIGNAL(readyReadStandardOutput()),this,SLOT(process_readyReadStandardOutput()));
QObject::disconnect(&process,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(process_stateChanged(QProcess::ProcessState)));
// Prevent overbuild
protect.unlock();
return ok;
}
@@ -362,13 +449,13 @@ bool CCC65Interface::captureDebugInfo()
QDir dir(QDir::currentPath());
QString dbgInfoFile;
if ( nesicideProject->getProjectDebugInfoName().isEmpty() )
if ( CNesicideProject::instance()->getProjectDebugInfoName().isEmpty() )
{
dbgInfoFile = dir.fromNativeSeparators(dir.relativeFilePath(nesicideProject->getProjectOutputName()+".dbg"));
dbgInfoFile = dir.fromNativeSeparators(dir.relativeFilePath(CNesicideProject::instance()->getProjectOutputName()+".dbg"));
}
else
{
dbgInfoFile = dir.fromNativeSeparators(dir.relativeFilePath(nesicideProject->getProjectDebugInfoName()));
dbgInfoFile = dir.fromNativeSeparators(dir.relativeFilePath(CNesicideProject::instance()->getProjectDebugInfoName()));
}
buildTextLogger->write("<font color='black'><b>Reading debug information from: "+dbgInfoFile+"</b></font>");
@@ -389,7 +476,6 @@ bool CCC65Interface::captureDebugInfo()
bool CCC65Interface::isBuildUpToDate()
{
QProcess make;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
QString invocationStr;
QString stdioStr;
@@ -400,13 +486,22 @@ bool CCC65Interface::isBuildUpToDate()
"is rebuilt.\n\n";
bool ok = true;
// Prevent overbuild
protect.lock();
// 'Build' is up-to-date if no sources present.
if ( (getCLanguageSourcesFromProject().count() ||
(getAssemblerSourcesFromProject().count())) )
{
// Copy the system environment to the child process.
make.setProcessEnvironment(env);
make.setWorkingDirectory(QDir::currentPath());
process.setProcessEnvironment(env);
process.setWorkingDirectory(QDir::currentPath());
QObject::connect(&process,SIGNAL(started()),this,SLOT(process_started()));
QObject::connect(&process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(process_finished(int,QProcess::ExitStatus)));
QObject::connect(&process,SIGNAL(errorOccurred(QProcess::ProcessError)),this,SLOT(process_errorOccurred(QProcess::ProcessError)));
QObject::connect(&process,SIGNAL(readyReadStandardError()),this,SLOT(process_readyReadStandardError()));
QObject::connect(&process,SIGNAL(readyReadStandardOutput()),this,SLOT(process_readyReadStandardOutput()));
QObject::connect(&process,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(process_stateChanged(QProcess::ProcessState)));
// Clear the error storage.
errors.clear();
@@ -415,17 +510,27 @@ bool CCC65Interface::isBuildUpToDate()
invocationStr = "make -f nesicide.mk -q all";
make.start(invocationStr);
make.waitForFinished();
exitCode = make.exitCode();
process.start(invocationStr);
process.waitForFinished();
exitCode = process.exitCode();
if ( exitCode == 1 )
{
QMessageBox::warning(NULL,"Consistency problem!",outdated);
ok = false;
}
QObject::disconnect(&process,SIGNAL(started()),this,SLOT(process_started()));
QObject::disconnect(&process,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(process_finished(int,QProcess::ExitStatus)));
QObject::disconnect(&process,SIGNAL(errorOccurred(QProcess::ProcessError)),this,SLOT(process_errorOccurred(QProcess::ProcessError)));
QObject::disconnect(&process,SIGNAL(readyReadStandardError()),this,SLOT(process_readyReadStandardError()));
QObject::disconnect(&process,SIGNAL(readyReadStandardOutput()),this,SLOT(process_readyReadStandardOutput()));
QObject::disconnect(&process,SIGNAL(stateChanged(QProcess::ProcessState)),this,SLOT(process_stateChanged(QProcess::ProcessState)));
}
// Prevent overbuild
protect.unlock();
return ok;
}
@@ -434,18 +539,18 @@ bool CCC65Interface::captureINESImage()
QDir dir(QDir::currentPath());
QString nesName;
if ( nesicideProject->getProjectCartridgeOutputName().isEmpty() )
if ( CNesicideProject::instance()->getProjectCartridgeOutputName().isEmpty() )
{
nesName = dir.fromNativeSeparators(dir.relativeFilePath(nesicideProject->getProjectOutputName()+".nes"));
nesName = dir.fromNativeSeparators(dir.relativeFilePath(CNesicideProject::instance()->getProjectOutputName()+".nes"));
}
else
{
nesName = dir.fromNativeSeparators(dir.relativeFilePath(nesicideProject->getProjectCartridgeOutputName()));
nesName = dir.fromNativeSeparators(dir.relativeFilePath(CNesicideProject::instance()->getProjectCartridgeOutputName()));
}
buildTextLogger->write("<font color='black'><b>Reading NES executable from: "+nesName+"</b></font>");
return nesicideProject->createProjectFromRom(nesName,true);
return CNesicideProject::instance()->createProjectFromRom(nesName,true);
}
QStringList CCC65Interface::getSourceFiles()
@@ -609,20 +714,20 @@ unsigned int CCC65Interface::getSymbolAddress(QString symbol, int index)
return addr;
}
unsigned int CCC65Interface::getSymbolAbsoluteAddress(QString symbol, int index)
unsigned int CCC65Interface::getSymbolPhysicalAddress(QString symbol, int index)
{
// Dispatch to appropriate target machine handler.
if ( !targetMachine.compare("nes",Qt::CaseInsensitive) )
{
return nesGetSymbolAbsoluteAddress(symbol,index);
return nesGetSymbolPhysicalAddress(symbol,index);
}
else if ( !targetMachine.compare("c64",Qt::CaseInsensitive) )
{
return c64GetSymbolAbsoluteAddress(symbol,index);
return c64GetSymbolPhysicalAddress(symbol,index);
}
}
unsigned int CCC65Interface::nesGetSymbolAbsoluteAddress(QString symbol, int index)
unsigned int CCC65Interface::nesGetSymbolPhysicalAddress(QString symbol, int index)
{
const cc65_symbolinfo* dbgSymbols;
const cc65_segmentinfo* dbgSegments;
@@ -679,7 +784,7 @@ unsigned int CCC65Interface::nesGetSymbolAbsoluteAddress(QString symbol, int ind
return absAddr;
}
unsigned int CCC65Interface::c64GetSymbolAbsoluteAddress(QString symbol, int index)
unsigned int CCC65Interface::c64GetSymbolPhysicalAddress(QString symbol, int index)
{
const cc65_symbolinfo* dbgSymbols;
const cc65_segmentinfo* dbgSegments;
@@ -911,20 +1016,20 @@ int CCC65Interface::getSymbolMatchCount(QString symbol)
return count;
}
QString CCC65Interface::getSourceFileFromAbsoluteAddress(uint32_t addr,uint32_t absAddr)
QString CCC65Interface::getSourceFileFromPhysicalAddress(uint32_t addr,uint32_t absAddr)
{
// Dispatch to appropriate target machine handler.
if ( !targetMachine.compare("nes",Qt::CaseInsensitive) )
{
return QDir::fromNativeSeparators(nesGetSourceFileFromAbsoluteAddress(addr,absAddr));
return QDir::fromNativeSeparators(nesGetSourceFileFromPhysicalAddress(addr,absAddr));
}
else if ( !targetMachine.compare("c64",Qt::CaseInsensitive) )
{
return QDir::fromNativeSeparators(c64GetSourceFileFromAbsoluteAddress(addr,absAddr));
return QDir::fromNativeSeparators(c64GetSourceFileFromPhysicalAddress(addr,absAddr));
}
}
QString CCC65Interface::nesGetSourceFileFromAbsoluteAddress(uint32_t addr,uint32_t absAddr)
QString CCC65Interface::nesGetSourceFileFromPhysicalAddress(uint32_t addr,uint32_t absAddr)
{
const cc65_spaninfo* dbgSpans;
const cc65_segmentinfo* dbgSegments;
@@ -1017,7 +1122,7 @@ QString CCC65Interface::nesGetSourceFileFromAbsoluteAddress(uint32_t addr,uint32
return QDir::fromNativeSeparators(file);
}
QString CCC65Interface::c64GetSourceFileFromAbsoluteAddress(uint32_t addr,uint32_t absAddr)
QString CCC65Interface::c64GetSourceFileFromPhysicalAddress(uint32_t addr,uint32_t absAddr)
{
const cc65_spaninfo* dbgSpans;
const cc65_segmentinfo* dbgSegments;
@@ -1092,20 +1197,20 @@ QString CCC65Interface::c64GetSourceFileFromAbsoluteAddress(uint32_t addr,uint32
return QDir::fromNativeSeparators(file);
}
int CCC65Interface::getSourceLineFromAbsoluteAddress(uint32_t addr,uint32_t absAddr)
int CCC65Interface::getSourceLineFromPhysicalAddress(uint32_t addr,uint32_t absAddr)
{
// Dispatch to appropriate target machine handler.
if ( !targetMachine.compare("nes",Qt::CaseInsensitive) )
{
return nesGetSourceLineFromAbsoluteAddress(addr,absAddr);
return nesGetSourceLineFromPhysicalAddress(addr,absAddr);
}
else if ( !targetMachine.compare("c64",Qt::CaseInsensitive) )
{
return c64GetSourceLineFromAbsoluteAddress(addr,absAddr);
return c64GetSourceLineFromPhysicalAddress(addr,absAddr);
}
}
int CCC65Interface::nesGetSourceLineFromAbsoluteAddress(uint32_t addr,uint32_t absAddr)
int CCC65Interface::nesGetSourceLineFromPhysicalAddress(uint32_t addr,uint32_t absAddr)
{
const cc65_spaninfo* dbgSpans;
const cc65_lineinfo* dbgLines;
@@ -1191,7 +1296,7 @@ int CCC65Interface::nesGetSourceLineFromAbsoluteAddress(uint32_t addr,uint32_t a
return source_line;
}
int CCC65Interface::c64GetSourceLineFromAbsoluteAddress(uint32_t addr,uint32_t absAddr)
int CCC65Interface::c64GetSourceLineFromPhysicalAddress(uint32_t addr,uint32_t absAddr)
{
const cc65_spaninfo* dbgSpans;
const cc65_lineinfo* dbgLines;
@@ -1503,20 +1608,20 @@ unsigned int CCC65Interface::getAddressFromFileAndLine(QString file,int source_l
return addr;
}
unsigned int CCC65Interface::getAbsoluteAddressFromFileAndLine(QString file,int source_line,int entry)
unsigned int CCC65Interface::getPhysicalAddressFromFileAndLine(QString file,int source_line,int entry)
{
// Dispatch to appropriate target machine handler.
if ( !targetMachine.compare("nes",Qt::CaseInsensitive) )
{
return nesGetAbsoluteAddressFromFileAndLine(file,source_line,entry);
return nesGetPhysicalAddressFromFileAndLine(file,source_line,entry);
}
else if ( !targetMachine.compare("c64",Qt::CaseInsensitive) )
{
return c64GetAbsoluteAddressFromFileAndLine(file,source_line,entry);
return c64GetPhysicalAddressFromFileAndLine(file,source_line,entry);
}
}
unsigned int CCC65Interface::nesGetAbsoluteAddressFromFileAndLine(QString file,int source_line,int entry)
unsigned int CCC65Interface::nesGetPhysicalAddressFromFileAndLine(QString file,int source_line,int entry)
{
const cc65_sourceinfo* dbgSources;
const cc65_lineinfo* dbgLines;
@@ -1609,7 +1714,7 @@ unsigned int CCC65Interface::nesGetAbsoluteAddressFromFileAndLine(QString file,i
return absAddr;
}
unsigned int CCC65Interface::c64GetAbsoluteAddressFromFileAndLine(QString file,int source_line,int entry)
unsigned int CCC65Interface::c64GetPhysicalAddressFromFileAndLine(QString file,int source_line,int entry)
{
const cc65_sourceinfo* dbgSources;
const cc65_lineinfo* dbgLines;
@@ -1695,20 +1800,20 @@ unsigned int CCC65Interface::c64GetAbsoluteAddressFromFileAndLine(QString file,i
return absAddr;
}
unsigned int CCC65Interface::getEndAddressFromAbsoluteAddress(uint32_t addr,uint32_t absAddr)
unsigned int CCC65Interface::getEndAddressFromPhysicalAddress(uint32_t addr,uint32_t absAddr)
{
// Dispatch to appropriate target machine handler.
if ( !targetMachine.compare("nes",Qt::CaseInsensitive) )
{
return nesGetEndAddressFromAbsoluteAddress(addr,absAddr);
return nesGetEndAddressFromPhysicalAddress(addr,absAddr);
}
else if ( !targetMachine.compare("c64",Qt::CaseInsensitive) )
{
return c64GetEndAddressFromAbsoluteAddress(addr,absAddr);
return c64GetEndAddressFromPhysicalAddress(addr,absAddr);
}
}
unsigned int CCC65Interface::nesGetEndAddressFromAbsoluteAddress(uint32_t addr,uint32_t absAddr)
unsigned int CCC65Interface::nesGetEndAddressFromPhysicalAddress(uint32_t addr,uint32_t absAddr)
{
const cc65_lineinfo* dbgLines;
const cc65_spaninfo* dbgSpans;
@@ -1792,7 +1897,7 @@ unsigned int CCC65Interface::nesGetEndAddressFromAbsoluteAddress(uint32_t addr,u
return endAddr;
}
unsigned int CCC65Interface::c64GetEndAddressFromAbsoluteAddress(uint32_t addr,uint32_t absAddr)
unsigned int CCC65Interface::c64GetEndAddressFromPhysicalAddress(uint32_t addr,uint32_t absAddr)
{
const cc65_lineinfo* dbgLines;
const cc65_spaninfo* dbgSpans;
@@ -1858,21 +1963,21 @@ unsigned int CCC65Interface::c64GetEndAddressFromAbsoluteAddress(uint32_t addr,u
return endAddr;
}
bool CCC65Interface::isAbsoluteAddressAnOpcode(uint32_t absAddr)
bool CCC65Interface::isPhysicalAddressAnOpcode(uint32_t absAddr)
{
// Dispatch to appropriate target machine handler.
if ( !targetMachine.compare("nes",Qt::CaseInsensitive) )
{
return nesIsAbsoluteAddressAnOpcode(absAddr);
return nesIsPhysicalAddressAnOpcode(absAddr);
}
else if ( !targetMachine.compare("c64",Qt::CaseInsensitive) )
{
return c64IsAbsoluteAddressAnOpcode(absAddr);
return c64IsPhysicalAddressAnOpcode(absAddr);
}
return false;
}
bool CCC65Interface::nesIsAbsoluteAddressAnOpcode(uint32_t absAddr)
bool CCC65Interface::nesIsPhysicalAddressAnOpcode(uint32_t absAddr)
{
const cc65_spaninfo* dbgSpans;
const cc65_segmentinfo* dbgSegments;
@@ -1926,7 +2031,7 @@ bool CCC65Interface::nesIsAbsoluteAddressAnOpcode(uint32_t absAddr)
return opcode;
}
bool CCC65Interface::c64IsAbsoluteAddressAnOpcode(uint32_t absAddr)
bool CCC65Interface::c64IsPhysicalAddressAnOpcode(uint32_t absAddr)
{
const cc65_spaninfo* dbgSpans;
const cc65_segmentinfo* dbgSegments;
+74 -53
View File
@@ -2,6 +2,7 @@
#define CCC65INTERFACE_H
#include <QProcess>
#include <QMutex>
#include "stdint.h"
@@ -11,71 +12,91 @@ class CCC65Interface : public QObject
{
Q_OBJECT
public:
// Class maintenance.
CCC65Interface();
static CCC65Interface *_instance;
static CCC65Interface *instance()
{
if ( !_instance )
{
_instance = new CCC65Interface();
}
return _instance;
}
virtual ~CCC65Interface();
static void clear();
void clear();
// Makefile and target image APIs.
static bool createMakefile();
static void clean();
static bool assemble();
static bool captureDebugInfo();
static bool isBuildUpToDate();
static bool captureINESImage();
static QStringList getCLanguageSourcesFromProject();
static QStringList getAssemblerSourcesFromProject();
static QStringList getCustomSourcesFromProject();
static void updateTargetMachine(QString target);
bool createMakefile();
void clean();
bool assemble();
bool captureDebugInfo();
bool isBuildUpToDate();
bool captureINESImage();
QStringList getCLanguageSourcesFromProject();
QStringList getAssemblerSourcesFromProject();
QStringList getCustomSourcesFromProject();
void updateTargetMachine(QString target);
// Debug information parsing/extending APIs.
static QStringList getSourceFiles();
static uint32_t getSegmentBase(QString segment);
static unsigned int getSourceFileModificationTime(QString sourceFile);
static QStringList getSymbolsForSourceFile(QString sourceFile);
static int getSymbolMatchCount(QString symbol);
static cc65_symbol_type getSymbolType(QString symbol,int index = 0);
static unsigned int getSymbolAddress(QString symbol,int index = 0);
static unsigned int getSymbolSegment(QString symbol,int index = 0);
static QString getSymbolSegmentName(QString symbol, int index = 0);
static unsigned int getSymbolIndexFromSegment(QString symbol,int segment);
static unsigned int getSymbolSize(QString symbol,int index = 0);
static int getSourceLineFromFileAndSymbol(QString file,QString symbol);
static QString getSourceFileFromSymbol(QString symbol);
static int getLineMatchCount(QString file,int source_line);
static unsigned int getAddressFromFileAndLine(QString file,int source_line,int entry = -1);
static QStringList getErrors() { return errors; }
static bool isErrorOnLineOfFile(QString file,int source_line);
static bool isStringASymbol(QString string);
QStringList getSourceFiles();
uint32_t getSegmentBase(QString segment);
unsigned int getSourceFileModificationTime(QString sourceFile);
QStringList getSymbolsForSourceFile(QString sourceFile);
int getSymbolMatchCount(QString symbol);
cc65_symbol_type getSymbolType(QString symbol,int index = 0);
unsigned int getSymbolAddress(QString symbol,int index = 0);
unsigned int getSymbolSegment(QString symbol,int index = 0);
QString getSymbolSegmentName(QString symbol, int index = 0);
unsigned int getSymbolIndexFromSegment(QString symbol,int segment);
unsigned int getSymbolSize(QString symbol,int index = 0);
int getSourceLineFromFileAndSymbol(QString file,QString symbol);
QString getSourceFileFromSymbol(QString symbol);
int getLineMatchCount(QString file,int source_line);
unsigned int getAddressFromFileAndLine(QString file,int source_line,int entry = -1);
QStringList getErrors() { return errors; }
bool isErrorOnLineOfFile(QString file,int source_line);
bool isStringASymbol(QString string);
// Target-dependent launchpads.
static QString getSourceFileFromAbsoluteAddress(uint32_t addr,uint32_t absAddr);
static int getSourceLineFromAbsoluteAddress(uint32_t addr,uint32_t absAddr);
static unsigned int getAbsoluteAddressFromFileAndLine(QString file,int source_line,int entry = -1);
static unsigned int getEndAddressFromAbsoluteAddress(uint32_t addr,uint32_t absAddr);
static bool isAbsoluteAddressAnOpcode(uint32_t absAddr);
static unsigned int getSymbolAbsoluteAddress(QString symbol,int index = 0);
// Target-independent launchpads.
QString getSourceFileFromPhysicalAddress(uint32_t addr,uint32_t absAddr);
int getSourceLineFromPhysicalAddress(uint32_t addr,uint32_t absAddr);
unsigned int getPhysicalAddressFromFileAndLine(QString file,int source_line,int entry = -1);
unsigned int getEndAddressFromPhysicalAddress(uint32_t addr,uint32_t absAddr);
bool isPhysicalAddressAnOpcode(uint32_t absAddr);
unsigned int getSymbolPhysicalAddress(QString symbol,int index = 0);
// NES target-dependent APIs.
static QString nesGetSourceFileFromAbsoluteAddress(uint32_t addr,uint32_t absAddr);
static int nesGetSourceLineFromAbsoluteAddress(uint32_t addr,uint32_t absAddr);
static unsigned int nesGetAbsoluteAddressFromFileAndLine(QString file,int source_line,int entry = -1);
static unsigned int nesGetEndAddressFromAbsoluteAddress(uint32_t addr,uint32_t absAddr);
static bool nesIsAbsoluteAddressAnOpcode(uint32_t absAddr);
static unsigned int nesGetSymbolAbsoluteAddress(QString symbol,int index = 0);
QString nesGetSourceFileFromPhysicalAddress(uint32_t addr,uint32_t absAddr);
int nesGetSourceLineFromPhysicalAddress(uint32_t addr,uint32_t absAddr);
unsigned int nesGetPhysicalAddressFromFileAndLine(QString file,int source_line,int entry = -1);
unsigned int nesGetEndAddressFromPhysicalAddress(uint32_t addr,uint32_t absAddr);
bool nesIsPhysicalAddressAnOpcode(uint32_t absAddr);
unsigned int nesGetSymbolPhysicalAddress(QString symbol,int index = 0);
// C64 target-dependent APIs.
static QString c64GetSourceFileFromAbsoluteAddress(uint32_t addr,uint32_t absAddr);
static int c64GetSourceLineFromAbsoluteAddress(uint32_t addr,uint32_t absAddr);
static unsigned int c64GetAbsoluteAddressFromFileAndLine(QString file,int source_line,int entry = -1);
static unsigned int c64GetEndAddressFromAbsoluteAddress(uint32_t addr,uint32_t absAddr);
static bool c64IsAbsoluteAddressAnOpcode(uint32_t absAddr);
static unsigned int c64GetSymbolAbsoluteAddress(QString symbol,int index = 0);
QString c64GetSourceFileFromPhysicalAddress(uint32_t addr,uint32_t absAddr);
int c64GetSourceLineFromPhysicalAddress(uint32_t addr,uint32_t absAddr);
unsigned int c64GetPhysicalAddressFromFileAndLine(QString file,int source_line,int entry = -1);
unsigned int c64GetEndAddressFromPhysicalAddress(uint32_t addr,uint32_t absAddr);
bool c64IsPhysicalAddressAnOpcode(uint32_t absAddr);
unsigned int c64GetSymbolPhysicalAddress(QString symbol,int index = 0);
public slots:
void process_errorOccurred(QProcess::ProcessError error);
void process_finished(int exitCode, QProcess::ExitStatus exitStatus);
void process_readyReadStandardError();
void process_readyReadStandardOutput();
void process_started();
void process_stateChanged(QProcess::ProcessState newState);
protected:
static cc65_dbginfo dbgInfo;
static QStringList errors;
static QString targetMachine;
cc65_dbginfo dbgInfo;
QStringList errors;
QString targetMachine;
QMutex protect;
QProcess process;
private:
CCC65Interface();
};
#endif // CCC65INTERFACE_H
+52 -37
View File
@@ -3,15 +3,63 @@
#include "ccartridgebuilder.h"
#include "cmachineimagebuilder.h"
#include "main.h"
#include "cnesicideproject.h"
CompilerWorker::CompilerWorker(QObject*)
{
m_assembledOk = false;
}
CompilerWorker::~CompilerWorker()
{
}
void CompilerWorker::compile()
{
CCartridgeBuilder cartridgeBuilder;
CMachineImageBuilder machineImageBuilder;
emit compileStarted();
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
m_assembledOk = cartridgeBuilder.build();
}
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
m_assembledOk = machineImageBuilder.build();
}
emit compileDone(m_assembledOk);
}
void CompilerWorker::clean()
{
CCartridgeBuilder cartridgeBuilder;
CMachineImageBuilder machineImageBuilder;
emit cleanStarted();
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
cartridgeBuilder.clean();
}
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
machineImageBuilder.clean();
}
emit cleanDone(true);
}
CompilerThread::CompilerThread(QObject*)
{
m_assembledOk = false;
pWorker = new CompilerWorker();
QObject::connect(pWorker,SIGNAL(cleanDone(bool)),this,SIGNAL(cleanDone(bool)));
QObject::connect(pWorker,SIGNAL(cleanStarted()),this,SIGNAL(cleanStarted()));
QObject::connect(pWorker,SIGNAL(compileDone(bool)),this,SIGNAL(compileDone(bool)));
QObject::connect(pWorker,SIGNAL(compileStarted()),this,SIGNAL(compileStarted()));
pThread = new QThread();
moveToThread(pThread);
pWorker->moveToThread(pThread);
pThread->start();
}
@@ -21,38 +69,5 @@ CompilerThread::~CompilerThread()
pThread->exit(0);
pThread->wait();
delete pThread;
}
void CompilerThread::compile()
{
CCartridgeBuilder cartridgeBuilder;
CMachineImageBuilder machineImageBuilder;
emit compileStarted();
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
m_assembledOk = cartridgeBuilder.build();
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
m_assembledOk = machineImageBuilder.build();
}
emit compileDone(m_assembledOk);
}
void CompilerThread::clean()
{
CCartridgeBuilder cartridgeBuilder;
CMachineImageBuilder machineImageBuilder;
emit cleanStarted();
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
cartridgeBuilder.clean();
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
machineImageBuilder.clean();
}
emit cleanDone(true);
delete pWorker;
}
+27 -5
View File
@@ -10,17 +10,16 @@ enum
DoClean
};
class CompilerThread : public QObject
class CompilerWorker : public QObject
{
Q_OBJECT
public:
CompilerThread ( QObject* parent = 0 );
virtual ~CompilerThread ();
CompilerWorker ( QObject* parent = 0 );
virtual ~CompilerWorker ();
bool assembledOk() { return m_assembledOk; }
void reset() { m_assembledOk = false; }
public slots:
void compile();
void clean();
@@ -33,8 +32,31 @@ signals:
protected:
bool m_assembledOk;
int m_operation;
};
QThread* pThread;
class CompilerThread : public QObject
{
Q_OBJECT
public:
CompilerThread ( QObject* parent = 0 );
virtual ~CompilerThread ();
bool assembledOk() { return pWorker->assembledOk(); }
void reset() { pWorker->reset(); }
public slots:
void compile() { pWorker->compile(); }
void clean() { pWorker->clean(); }
signals:
void compileStarted();
void compileDone(bool bOk);
void cleanStarted();
void cleanDone(bool bOk);
protected:
CompilerWorker *pWorker;
QThread *pThread;
};
#endif // COMPILERTHREAD_H
+3 -5
View File
@@ -4,20 +4,18 @@
#include "ccc65interface.h"
#include "main.h"
CSourceAssembler::CSourceAssembler()
{
}
void CSourceAssembler::clean()
{
return CCC65Interface::clean();
CCC65Interface::instance()->clean();
}
bool CSourceAssembler::assemble()
{
IProjectTreeViewItemIterator iter(nesicideProject);
IProjectTreeViewItemIterator iter(CNesicideProject::instance());
IProjectTreeViewItem* item;
bool ok = true;
@@ -40,7 +38,7 @@ bool CSourceAssembler::assemble()
if ( ok )
{
ok = CCC65Interface::assemble();
ok = CCC65Interface::instance()->assemble();
}
return ok;
+23 -20
View File
@@ -1,3 +1,5 @@
#include <QFileInfo>
#include "breakpointdialog.h"
#include "ui_breakpointdialog.h"
@@ -8,12 +10,13 @@
#include "dbg_cnesapu.h"
#include "compilerthread.h"
#include "main.h"
#include "ccc65interface.h"
#include "cobjectregistry.h"
#include "cnesicideproject.h"
BreakpointDialog::BreakpointDialog(CBreakpointInfo* pBreakpoints,int bp, QWidget* parent) :
QDialog(parent),
ui(new Ui::BreakpointDialog)
@@ -27,7 +30,7 @@ BreakpointDialog::BreakpointDialog(CBreakpointInfo* pBreakpoints,int bp, QWidget
ui->type->addItem("CPU Memory Read");
ui->type->addItem("CPU Memory Write");
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
ui->type->addItem("CPU State");
ui->type->addItem("CPU Event");
@@ -54,14 +57,14 @@ BreakpointDialog::BreakpointDialog(CBreakpointInfo* pBreakpoints,int bp, QWidget
ui->enabled->setChecked(true);
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
ui->resolverWidget->setCurrentIndex(nesGetMapper()>0);
ui->resolve->setChecked(false);
ui->resolutions->addItem("N/A");
ui->resolutions->setEnabled(false);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
ui->resolverWidget->setCurrentIndex(0);
ui->resolve->setChecked(false);
@@ -447,7 +450,7 @@ void BreakpointDialog::DisplayResolutions(BreakpointInfo* pBreakpoint)
QString text;
QStringList textSplit;
QFileInfo fileInfo;
CompilerThread* compiler = dynamic_cast<CompilerThread*>(CObjectRegistry::getObject("Compiler"));
CompilerThread* compiler = dynamic_cast<CompilerThread*>(CObjectRegistry::instance()->getObject("Compiler"));
// Get address from UI
originalAddr = ui->addr1->text().toInt(0,16);
@@ -468,14 +471,14 @@ void BreakpointDialog::DisplayResolutions(BreakpointInfo* pBreakpoint)
{
if ( compiler->assembledOk() )
{
source = CCC65Interface::getSourceFileFromAbsoluteAddress(originalAddr,maskedAddr);
source = CCC65Interface::instance()->getSourceFileFromPhysicalAddress(originalAddr,maskedAddr);
if ( !source.isEmpty() )
{
fileInfo.setFile(source);
source = fileInfo.fileName();
text = "put something";//pasm_get_source_file_text_by_addr(maskedAddr);
linenum = CCC65Interface::getSourceLineFromAbsoluteAddress(originalAddr,maskedAddr);
linenum = CCC65Interface::instance()->getSourceLineFromPhysicalAddress(originalAddr,maskedAddr);
// textSplit = text.split(QRegExp("[\r\n]"));
// text = textSplit.at(linenum-1);
item.sprintf("%s:%d:",
@@ -488,13 +491,13 @@ void BreakpointDialog::DisplayResolutions(BreakpointInfo* pBreakpoint)
}
else
{
nesGetDisassemblyAtAbsoluteAddress(maskedAddr,disassembly);
nesGetPrintableAddressWithAbsolute(address,originalAddr,maskedAddr);
nesGetDisassemblyAtPhysicalAddress(maskedAddr,disassembly);
nesGetPrintablePhysicalAddress(address,originalAddr,maskedAddr);
item.sprintf("%s:%s",address,disassembly);
ui->resolutions->addItem(item);
ui->resolutions->setItemData(ui->resolutions->count()-1,maskedAddr);
}
if ( pBreakpoint && pBreakpoint->item1Absolute == maskedAddr )
if ( pBreakpoint && pBreakpoint->item1Physical == maskedAddr )
{
ui->resolutions->setCurrentIndex(ui->resolutions->count()-1);
}
@@ -528,8 +531,8 @@ void BreakpointDialog::DisplayBreakpoint ( int idx )
// Turn resolver on so it populates if the absolute address is known.
// Only do this for NES platform until it is known whether it is needed
// for other platforms.
if ( (!nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive)) &&
(pBreakpoint->item1Absolute >= 0) )
if ( (!CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive)) &&
(pBreakpoint->item1Physical >= 0) )
{
ui->resolve->setChecked(true);
}
@@ -629,7 +632,7 @@ void BreakpointDialog::on_cancel_clicked()
void BreakpointDialog::on_addBreakpoint_clicked()
{
int item1 = 0;
int item1Absolute = 0;
int item1Physical = 0;
int item2 = 0;
int mask = 0;
int data = 0;
@@ -689,12 +692,12 @@ void BreakpointDialog::on_addBreakpoint_clicked()
if ( ui->resolve->isChecked() )
{
item1Absolute = ui->resolutions->itemData(ui->resolutions->currentIndex()).toInt();
item1Physical = ui->resolutions->itemData(ui->resolutions->currentIndex()).toInt();
}
else
{
// NES
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
// If the virtual address is in PRG-ROM space, convert it to physical for
// the absolute address. Otherwise, the virtual *is* the physical address.
@@ -704,23 +707,23 @@ void BreakpointDialog::on_addBreakpoint_clicked()
{
// If there's more than 16KB of PRG-ROM then the
// physical address is simply the offset into the PRG-ROM.
item1Absolute = (item1-MEM_32KB)%nesGetPRGROMSize();
item1Physical = (item1-MEM_32KB)%nesGetPRGROMSize();
}
else if ( item1 >= 0x6000 )
{
// CPTODO: For now assume identity mapped SRAM.
item1Absolute = (item1-0x6000);
item1Physical = (item1-0x6000);
}
else
{
// Virtual is physical if address is less than $8000.
item1Absolute = item1;
item1Physical = item1;
}
}
else
{
// Virtual is physical for now. Might need to revisit.
item1Absolute = item1;
item1Physical = item1;
}
}
@@ -729,7 +732,7 @@ void BreakpointDialog::on_addBreakpoint_clicked()
(eBreakpointItemType)ui->itemWidget->currentIndex(),
event,
item1,
item1Absolute,
item1Physical,
item2,
mask,
maskExclusive,
+624 -184
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>330</width>
<height>222</height>
<width>541</width>
<height>320</height>
</rect>
</property>
<property name="sizePolicy">
@@ -18,20 +18,35 @@
</property>
<property name="minimumSize">
<size>
<width>330</width>
<height>0</height>
<width>416</width>
<height>292</height>
</size>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0" colspan="2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="formAlignment">
<set>Qt::AlignJustify|Qt::AlignTop</set>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -46,6 +61,12 @@
</item>
<item row="0" column="1">
<widget class="QComboBox" name="type">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>20</number>
</property>
@@ -53,86 +74,225 @@
</item>
</layout>
</item>
<item row="1" column="0" colspan="2">
<item>
<widget class="QStackedWidget" name="itemWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="addrpage">
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="addr1label">
<property name="text">
<string>Address 1:</string>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="0">
<layout class="QFormLayout" name="formLayout_8">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
</widget>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="formAlignment">
<set>Qt::AlignJustify|Qt::AlignTop</set>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Mask:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="mask">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="3">
<widget class="QLabel" name="addr2label">
<property name="text">
<string>Address 2:</string>
<item row="1" column="1">
<layout class="QFormLayout" name="formLayout_7">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
</widget>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="formAlignment">
<set>Qt::AlignJustify|Qt::AlignTop</set>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="addr2label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Address 2:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="addr2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxLength">
<number>4</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="4">
<widget class="QLineEdit" name="addr2">
<property name="maxLength">
<number>4</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="addr1">
<property name="maxLength">
<number>4</number>
<item row="2" column="1">
<widget class="QComboBox" name="itemMaskScope">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item>
<property name="text">
<string>Exclusive (unmasked bits 0)</string>
</property>
</item>
<item>
<property name="text">
<string>Inclusive (unmasked bits X)</string>
</property>
</item>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Mask:</string>
<layout class="QFormLayout" name="formLayout_6">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mask"/>
</item>
<item row="1" column="3" colspan="2">
<widget class="QComboBox" name="itemMaskScope">
<item>
<property name="text">
<string>Exclusive (unmasked bits must be zero)</string>
</property>
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="formAlignment">
<set>Qt::AlignJustify|Qt::AlignTop</set>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="addr1label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Address 1:</string>
</property>
</widget>
</item>
<item>
<property name="text">
<string>Inclusive (unmasked bits are ignored)</string>
</property>
<item row="0" column="1">
<widget class="QLineEdit" name="addr1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxLength">
<number>4</number>
</property>
</widget>
</item>
</widget>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="regpage">
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="margin">
<property name="labelAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="registerlabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Register:</string>
</property>
@@ -140,30 +300,73 @@
</item>
<item row="0" column="1">
<widget class="QComboBox" name="reg">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>25</number>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="bitfieldlabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Bitfield:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="bitfield"/>
<widget class="QComboBox" name="bitfield">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="eventpage">
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Event:</string>
</property>
@@ -171,6 +374,12 @@
</item>
<item row="0" column="1" colspan="3">
<widget class="QComboBox" name="event">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maxVisibleItems">
<number>100</number>
</property>
@@ -178,33 +387,339 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="item1label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data1:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="eventData1"/>
<widget class="QLineEdit" name="eventData1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="item2label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Data2:</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLineEdit" name="eventData2"/>
<widget class="QLineEdit" name="eventData2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="emptypage"/>
<widget class="QWidget" name="emptypage">
<layout class="QGridLayout" name="gridLayout_10">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
</layout>
</widget>
</widget>
</item>
<item row="2" column="0">
<widget class="QStackedWidget" name="conditionWidget">
<item>
<layout class="QGridLayout" name="gridLayout_8">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QStackedWidget" name="conditionWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="emptyCondition">
<layout class="QGridLayout" name="gridLayout_9">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="addrCondition">
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="conditionlabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Break if:</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="condition">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToMinimumContentsLength</enum>
</property>
<item>
<property name="text">
<string>Anything</string>
</property>
</item>
<item>
<property name="text">
<string>Equals</string>
</property>
</item>
<item>
<property name="text">
<string>Does Not Equal</string>
</property>
</item>
<item>
<property name="text">
<string>Is Greater Than</string>
</property>
</item>
<item>
<property name="text">
<string>Is Less Than</string>
</property>
</item>
<item>
<property name="text">
<string>Exclusive Mask (unmasked bits 0)</string>
</property>
</item>
<item>
<property name="text">
<string>Inclusive Mask (unmasked bits X)</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="0" column="1">
<widget class="QStackedWidget" name="dataWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="emptyData">
<layout class="QGridLayout" name="gridLayout_7">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="editData">
<layout class="QFormLayout" name="formLayout_5">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="data1label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Condition:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="data1">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="comboData">
<layout class="QFormLayout" name="formLayout_4">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="data2label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Condition:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="data2">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="sizeAdjustPolicy">
<enum>QComboBox::AdjustToContentsOnFirstShow</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QStackedWidget" name="resolverWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -212,121 +727,69 @@
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="emptyCondition"/>
<widget class="QWidget" name="addrCondition">
<layout class="QFormLayout" name="formLayout_3">
<widget class="QWidget" name="emptyMap">
<layout class="QGridLayout" name="gridLayout_11">
<property name="spacing">
<number>6</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="useMap">
<layout class="QFormLayout" name="formLayout_9">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
<enum>QFormLayout::ExpandingFieldsGrow</enum>
</property>
<property name="margin">
<number>0</number>
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="conditionlabel">
<widget class="QCheckBox" name="resolve">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Break if:</string>
<string>Resolve using Mapper</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="condition">
<item>
<property name="text">
<string>Anything</string>
</property>
</item>
<item>
<property name="text">
<string>Equals</string>
</property>
</item>
<item>
<property name="text">
<string>Does Not Equal</string>
</property>
</item>
<item>
<property name="text">
<string>Is Greater Than</string>
</property>
</item>
<item>
<property name="text">
<string>Is Less Than</string>
</property>
</item>
<item>
<property name="text">
<string>Exclusive Mask (unmasked bits must be zero)</string>
</property>
</item>
<item>
<property name="text">
<string>Inclusive Mask (unmasked bits are ignored)</string>
</property>
</item>
<widget class="QComboBox" name="resolutions">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="2" column="1">
<widget class="QStackedWidget" name="dataWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="currentIndex">
<number>2</number>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
<widget class="QWidget" name="emptyData">
<layout class="QGridLayout" name="gridLayout_7">
<property name="margin">
<number>0</number>
</property>
</layout>
</widget>
<widget class="QWidget" name="editData">
<layout class="QFormLayout" name="formLayout_5">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="data1label">
<property name="text">
<string>Condition:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="data1"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="comboData">
<layout class="QFormLayout" name="formLayout_4">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="data2label">
<property name="text">
<string>Condition:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="data2"/>
</item>
</layout>
</widget>
</widget>
</spacer>
</item>
<item row="5" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0">
<property name="spacing">
<number>6</number>
</property>
<item>
<widget class="QPushButton" name="cancel">
<property name="text">
@@ -339,6 +802,9 @@
</item>
<item>
<widget class="QCheckBox" name="enabled">
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="text">
<string>Enabled</string>
</property>
@@ -356,35 +822,10 @@
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
<widget class="QStackedWidget" name="resolverWidget">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="emptyMap"/>
<widget class="QWidget" name="useMap">
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QComboBox" name="resolutions"/>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="resolve">
<property name="text">
<string>Resolve using Mapper</string>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<tabstops>
<tabstop>type</tabstop>
<tabstop>addr1</tabstop>
<tabstop>addr2</tabstop>
<tabstop>mask</tabstop>
<tabstop>bitfield</tabstop>
<tabstop>event</tabstop>
<tabstop>eventData1</tabstop>
@@ -395,7 +836,6 @@
<tabstop>cancel</tabstop>
<tabstop>enabled</tabstop>
<tabstop>addBreakpoint</tabstop>
<tabstop>resolutions</tabstop>
<tabstop>resolve</tabstop>
<tabstop>reg</tabstop>
</tabstops>
+42 -25
View File
@@ -1,4 +1,9 @@
#include <QStandardItemModel>
#include <QMenu>
#include <QContextMenuEvent>
#include <QDragEnterEvent>
#include <QDragMoveEvent>
#include <QDropEvent>
#include "breakpointdockwidget.h"
#include "ui_breakpointdockwidget.h"
@@ -15,7 +20,7 @@
#include "ccc65interface.h"
#include "main.h"
#include "cnesicideproject.h"
#include "cobjectregistry.h"
#include "nes_emulator_core.h"
@@ -43,15 +48,15 @@ BreakpointDockWidget::~BreakpointDockWidget()
delete model;
}
void BreakpointDockWidget::updateTargetMachine(QString /*target*/)
void BreakpointDockWidget::updateTargetMachine(QString target)
{
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),this,SLOT(updateData()) );
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),model,SLOT(update()));
if ( emulator )
if ( target.compare("none") )
{
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),this,SLOT(updateData()) );
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),model,SLOT(update()));
QObject::connect(emulator,SIGNAL(machineReady()),model,SLOT(update()));
QObject::connect(emulator,SIGNAL(emulatorReset()),model,SLOT(update()));
QObject::connect(emulator,SIGNAL(emulatorPaused(bool)),model,SLOT(update()));
@@ -102,23 +107,23 @@ void BreakpointDockWidget::changeEvent(QEvent* e)
void BreakpointDockWidget::showEvent(QShowEvent*)
{
QDockWidget* codeBrowser = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Assembly Browser"));
QDockWidget* symbolInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Symbol Inspector"));
QDockWidget* codeBrowser = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Assembly Browser"));
QDockWidget* symbolInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Symbol Inspector"));
QDockWidget* memoryInspector;
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject::connect(codeBrowser,SIGNAL(breakpointsChanged()),model, SLOT(update()) );
QObject::connect(symbolInspector,SIGNAL(breakpointsChanged()),model, SLOT(update()) );
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("CPU RAM Inspector"));
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("CPU RAM Inspector"));
QObject::connect(memoryInspector,SIGNAL(breakpointsChanged()),model, SLOT(update()) );
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Cartridge EXRAM Memory Inspector"));
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Cartridge EXRAM Memory Inspector"));
QObject::connect(memoryInspector,SIGNAL(breakpointsChanged()),model, SLOT(update()) );
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Cartridge SRAM Memory Inspector"));
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Cartridge SRAM Memory Inspector"));
QObject::connect(memoryInspector,SIGNAL(breakpointsChanged()),model, SLOT(update()) );
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("PRG-ROM Inspector"));
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("PRG-ROM Inspector"));
QObject::connect(memoryInspector,SIGNAL(breakpointsChanged()),model, SLOT(update()) );
}
@@ -127,15 +132,15 @@ void BreakpointDockWidget::showEvent(QShowEvent*)
QObject::connect(codeBrowser,SIGNAL(breakpointsChanged()),emulator, SLOT(breakpointsChanged()) );
QObject::connect(symbolInspector,SIGNAL(breakpointsChanged()),model, SLOT(update()) );
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("CPU RAM Inspector"));
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("CPU RAM Inspector"));
QObject::connect(memoryInspector,SIGNAL(breakpointsChanged()),emulator, SLOT(breakpointsChanged()) );
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Cartridge EXRAM Memory Inspector"));
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Cartridge EXRAM Memory Inspector"));
QObject::connect(memoryInspector,SIGNAL(breakpointsChanged()),emulator, SLOT(breakpointsChanged()) );
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Cartridge SRAM Memory Inspector"));
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Cartridge SRAM Memory Inspector"));
QObject::connect(memoryInspector,SIGNAL(breakpointsChanged()),emulator, SLOT(breakpointsChanged()) );
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("PRG-ROM Inspector"));
memoryInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("PRG-ROM Inspector"));
QObject::connect(memoryInspector,SIGNAL(breakpointsChanged()),emulator, SLOT(breakpointsChanged()) );
}
}
@@ -170,6 +175,7 @@ void BreakpointDockWidget::contextMenuEvent(QContextMenuEvent *e)
if ( m_pBreakpoints->GetNumBreakpoints() > 0 )
{
menu.addAction(ui->actionRemove_Breakpoint);
menu.addAction(ui->actionRemove_All_Breakpoints);
menu.addAction(ui->actionEnable_All_Breakpoints);
menu.addAction(ui->actionDisable_All_Breakpoints);
}
@@ -224,7 +230,7 @@ void BreakpointDockWidget::dropEvent(QDropEvent *event)
if ( event->isAccepted() )
{
addr = CCC65Interface::getSymbolAddress(text);
addr = CCC65Interface::instance()->getSymbolAddress(text);
if ( addr != 0xFFFFFFFF )
{
bpIdx = m_pBreakpoints->AddBreakpoint ( eBreakOnCPUMemoryAccess,
@@ -292,7 +298,7 @@ void BreakpointDockWidget::on_tableView_pressed(QModelIndex index)
if ( (index.row() < m_pBreakpoints->GetNumBreakpoints()) &&
(m_pBreakpoints->GetBreakpoint(index.row())->type == eBreakOnCPUExecution) )
{
nesGetPrintableAddressWithAbsolute(buffer,m_pBreakpoints->GetBreakpoint(index.row())->item1,m_pBreakpoints->GetBreakpoint(index.row())->item1Absolute);
nesGetPrintablePhysicalAddress(buffer,m_pBreakpoints->GetBreakpoint(index.row())->item1,m_pBreakpoints->GetBreakpoint(index.row())->item1Physical);
emit snapTo(QString("Address,")+QString(buffer));
}
@@ -366,6 +372,17 @@ void BreakpointDockWidget::on_actionRemove_Breakpoint_triggered()
}
}
void BreakpointDockWidget::on_actionRemove_All_Breakpoints_triggered()
{
int idx = m_pBreakpoints->GetNumBreakpoints()-1;
for ( ; idx >= 0; idx-- )
{
m_pBreakpoints->RemoveBreakpoint(idx);
}
emit breakpointsChanged();
emit markProjectDirty(true);
}
void BreakpointDockWidget::on_actionEdit_Breakpoint_triggered()
{
int result;
@@ -442,7 +459,7 @@ bool BreakpointDockWidget::serialize(QDomDocument& doc, QDomNode& node)
breakpointElement.setAttribute("itemtype",pBreakpoint->itemType);
breakpointElement.setAttribute("event",pBreakpoint->event);
breakpointElement.setAttribute("item1",pBreakpoint->item1);
breakpointElement.setAttribute("item1absolute",pBreakpoint->item1Absolute);
breakpointElement.setAttribute("item1absolute",pBreakpoint->item1Physical);
breakpointElement.setAttribute("item2",pBreakpoint->item2);
breakpointElement.setAttribute("itemMask",pBreakpoint->itemMask);
breakpointElement.setAttribute("itemMaskExclusive",pBreakpoint->itemMaskExclusive);
@@ -488,7 +505,7 @@ bool BreakpointDockWidget::deserialize(QDomDocument& /*doc*/, QDomNode& node, QS
breakpoint.itemType = (eBreakpointItemType)element.attribute("itemtype").toInt();
breakpoint.event = element.attribute("event").toInt();
breakpoint.item1 = element.attribute("item1").toInt();
breakpoint.item1Absolute = element.attribute("item1absolute").toInt();
breakpoint.item1Physical = element.attribute("item1absolute").toInt();
breakpoint.item2 = element.attribute("item2").toInt();
breakpoint.itemMask = element.attribute("itemMask").toInt();
breakpoint.itemMaskExclusive = element.attribute("itemMaskExclusive").toInt();
@@ -56,6 +56,7 @@ private slots:
void on_actionEnable_Breakpoint_triggered();
void on_actionEdit_Breakpoint_triggered();
void on_actionRemove_Breakpoint_triggered();
void on_actionRemove_All_Breakpoints_triggered();
void on_actionAdd_Breakpoint_triggered();
};
+19 -5
View File
@@ -30,11 +30,17 @@
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item row="0" column="0">
<widget class="QTableView" name="tableView">
@@ -86,10 +92,10 @@
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<attribute name="verticalHeaderMinimumSectionSize">
<number>23</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<attribute name="verticalHeaderDefaultSectionSize">
<number>23</number>
</attribute>
</widget>
@@ -134,6 +140,14 @@
<string>Disable All Breakpoints</string>
</property>
</action>
<action name="actionRemove_All_Breakpoints">
<property name="text">
<string>Remove All Breakpoints</string>
</property>
<property name="toolTip">
<string>Remove All Breakpoints</string>
</property>
</action>
</widget>
<resources/>
<connections/>
+36 -15
View File
@@ -1,37 +1,36 @@
#include "breakpointwatcherthread.h"
#include <QSemaphore>
#include <stdio.h>
#include "main.h"
#include "cbreakpointinfo.h"
#include "cnesicideproject.h"
BreakpointWatcherThread::BreakpointWatcherThread(QObject*)
#include "nes_emulator_core.h"
#include "c64_emulator_core.h"
#include "cbuildertextlogger.h"
#include "outputpanedockwidget.h"
BreakpointWatcherWorker::BreakpointWatcherWorker(QObject*)
{
pThread = new QThread();
moveToThread(pThread);
pThread->start();
}
BreakpointWatcherThread::~BreakpointWatcherThread()
BreakpointWatcherWorker::~BreakpointWatcherWorker()
{
pThread->exit(0);
pThread->wait();
delete pThread;
}
void BreakpointWatcherThread::breakpoint()
void BreakpointWatcherWorker::breakpoint()
{
CBreakpointInfo* pBreakpoints = NULL;
int idx;
char hitMsg [ 512 ];
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
pBreakpoints = nesGetBreakpointDatabase();
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
pBreakpoints = c64GetBreakpointDatabase();
}
@@ -56,3 +55,25 @@ void BreakpointWatcherThread::breakpoint()
// A breakpoint has occurred...
emit breakpointHit();
}
BreakpointWatcherThread::BreakpointWatcherThread(QObject*)
{
pWorker = new BreakpointWatcherWorker();
QObject::connect(pWorker,SIGNAL(breakpointHit()),this,SIGNAL(breakpointHit()));
QObject::connect(pWorker,SIGNAL(showPane(int)),this,SIGNAL(showPane(int)));
pThread = new QThread();
pWorker->moveToThread(pThread);
pThread->start();
}
BreakpointWatcherThread::~BreakpointWatcherThread()
{
pThread->exit(0);
pThread->wait();
delete pThread;
delete pWorker;
}
+17 -2
View File
@@ -4,6 +4,20 @@
#include <QThread>
#include <QSemaphore>
class BreakpointWatcherWorker : public QObject
{
Q_OBJECT
public:
BreakpointWatcherWorker ( QObject* parent = 0 );
virtual ~BreakpointWatcherWorker ();
void breakpoint();
signals:
void breakpointHit();
void showPane(int pane);
};
class BreakpointWatcherThread : public QObject
{
Q_OBJECT
@@ -16,10 +30,11 @@ signals:
void showPane(int pane);
public slots:
void breakpoint();
void breakpoint() { pWorker->breakpoint(); }
protected:
QThread* pThread;
BreakpointWatcherWorker *pWorker;
QThread *pThread;
};
#endif // BREAKPOINTWATCHERTHREAD_H
@@ -7,17 +7,17 @@
#include <QIcon>
#include <QMimeData>
static char modelStringBuffer [ 2048 ];
static const char* CLICK_TO_ADD_OR_EDIT = "<click to add or edit>";
CBreakpointDisplayModel::CBreakpointDisplayModel(CBreakpointInfo* pBreakpoints,QObject*)
{
m_pBreakpoints = pBreakpoints;
m_modelStringBuffer = new char[256];
}
CBreakpointDisplayModel::~CBreakpointDisplayModel()
{
delete [] m_modelStringBuffer;
}
Qt::ItemFlags CBreakpointDisplayModel::flags(const QModelIndex& /*index*/) const
@@ -63,8 +63,8 @@ QVariant CBreakpointDisplayModel::data(const QModelIndex& index, int role) const
return QVariant();
break;
case 1:
m_pBreakpoints->GetPrintable(index.row(),modelStringBuffer);
return QVariant(modelStringBuffer);
m_pBreakpoints->GetPrintable(index.row(),m_modelStringBuffer);
return QVariant(m_modelStringBuffer);
break;
}
}
+2 -1
View File
@@ -17,7 +17,8 @@ public:
int rowCount(const QModelIndex& parent = QModelIndex()) const;
private:
CBreakpointInfo* m_pBreakpoints;
CBreakpointInfo *m_pBreakpoints;
char *m_modelStringBuffer;
public slots:
void update();
+46 -48
View File
@@ -14,29 +14,27 @@
#include "cmarker.h"
#include "main.h"
#include "nes_emulator_core.h"
#include "c64_emulator_core.h"
#include <QIcon>
static char modelStringBuffer [ 2048 ];
CCodeBrowserDisplayModel::CCodeBrowserDisplayModel(CBreakpointInfo* pBreakpoints,QObject*)
{
m_pBreakpoints = pBreakpoints;
m_modelStringBuffer = new char[2048];
}
CCodeBrowserDisplayModel::~CCodeBrowserDisplayModel()
{
delete [] m_modelStringBuffer;
}
QVariant CCodeBrowserDisplayModel::data(const QModelIndex& index, int role) const
{
// FIXME: 64-bit support
int32_t addr = (long)index.internalPointer();
int32_t absAddr;
int32_t physAddr;
//uint32_t addr = (uint32_t)index.internalPointer();
unsigned char opSize;
CMarker* markers = nesGetExecutionMarkerDatabase();
@@ -47,17 +45,17 @@ QVariant CCodeBrowserDisplayModel::data(const QModelIndex& index, int role) cons
uint32_t operand2;
uint32_t pc;
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
absAddr = nesGetAbsoluteAddressFromAddress(addr);
physAddr = nesGetPhysicalAddressFromAddress(addr);
opcode = nesGetMemory(addr);
operand1 = nesGetMemory(addr+1);
operand2 = nesGetMemory(addr+2);
pc = nesGetCPUProgramCounterOfLastSync();
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
absAddr = c64GetAbsoluteAddressFromAddress(addr);
physAddr = c64GetPhysicalAddressFromAddress(addr);
opcode = c64GetMemory(addr);
operand1 = c64GetMemory(addr+1);
operand2 = c64GetMemory(addr+2);
@@ -72,15 +70,15 @@ QVariant CCodeBrowserDisplayModel::data(const QModelIndex& index, int role) cons
{
if ( index.column() == CodeBrowserCol_Disassembly )
{
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
CNESDBG::CODEBROWSERTOOLTIP(TOOLTIP_INFO,addr,modelStringBuffer);
CNESDBG::CODEBROWSERTOOLTIP(TOOLTIP_INFO,addr,m_modelStringBuffer);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
CC64DBG::CODEBROWSERTOOLTIP(TOOLTIP_INFO,addr,modelStringBuffer);
CC64DBG::CODEBROWSERTOOLTIP(TOOLTIP_INFO,addr,m_modelStringBuffer);
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
else if ( index.column() > CodeBrowserCol_Address )
{
@@ -88,15 +86,15 @@ QVariant CCodeBrowserDisplayModel::data(const QModelIndex& index, int role) cons
if ( opSize > (index.column()-CodeBrowserCol_Opcode) )
{
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
CNESDBG::CODEBROWSERTOOLTIP(TOOLTIP_BYTES,addr+(index.column()-CodeBrowserCol_Opcode),modelStringBuffer);
CNESDBG::CODEBROWSERTOOLTIP(TOOLTIP_BYTES,addr+(index.column()-CodeBrowserCol_Opcode),m_modelStringBuffer);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
CC64DBG::CODEBROWSERTOOLTIP(TOOLTIP_BYTES,addr+(index.column()-CodeBrowserCol_Opcode),modelStringBuffer);
CC64DBG::CODEBROWSERTOOLTIP(TOOLTIP_BYTES,addr+(index.column()-CodeBrowserCol_Opcode),m_modelStringBuffer);
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
}
}
@@ -112,8 +110,8 @@ QVariant CCodeBrowserDisplayModel::data(const QModelIndex& index, int role) cons
if ( (pMarker->state == eMarkerSet_Started) ||
(pMarker->state == eMarkerSet_Complete) )
{
if ( (absAddr >= pMarker->startAbsAddr) &&
(absAddr <= pMarker->endAbsAddr) )
if ( (physAddr >= pMarker->startAbsAddr) &&
(physAddr <= pMarker->endAbsAddr) )
{
return QColor(pMarker->red,pMarker->green,pMarker->blue);
}
@@ -132,7 +130,7 @@ QVariant CCodeBrowserDisplayModel::data(const QModelIndex& index, int role) cons
if ( (pBreakpoint->enabled) &&
(pBreakpoint->type == eBreakOnCPUExecution) &&
(pBreakpoint->item1 <= addr) &&
((absAddr == -1) || (absAddr == pBreakpoint->item1Absolute)) &&
((physAddr == -1) || (physAddr == pBreakpoint->item1Physical)) &&
(pBreakpoint->item2 >= addr) )
{
if ( addr == pc )
@@ -147,7 +145,7 @@ QVariant CCodeBrowserDisplayModel::data(const QModelIndex& index, int role) cons
else if ( (!pBreakpoint->enabled) &&
(pBreakpoint->type == eBreakOnCPUExecution) &&
(pBreakpoint->item1 <= addr) &&
((absAddr == -1) || (absAddr == pBreakpoint->item1Absolute)) &&
((physAddr == -1) || (physAddr == pBreakpoint->item1Physical)) &&
(pBreakpoint->item2 >= addr) )
{
if ( addr == pc )
@@ -180,30 +178,30 @@ QVariant CCodeBrowserDisplayModel::data(const QModelIndex& index, int role) cons
switch ( index.column() )
{
case CodeBrowserCol_Address:
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
nesGetPrintableAddress(modelStringBuffer,addr);
nesGetPrintableAddress(m_modelStringBuffer,addr);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
c64GetPrintableAddress(modelStringBuffer,addr);
c64GetPrintableAddress(m_modelStringBuffer,addr);
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
break;
case CodeBrowserCol_Decoration:
return QVariant();
break;
case CodeBrowserCol_Opcode:
sprintf ( modelStringBuffer, "%02X", opcode );
return QVariant(modelStringBuffer);
sprintf ( m_modelStringBuffer, "%02X", opcode );
return QVariant(m_modelStringBuffer);
break;
case CodeBrowserCol_Operand1:
opSize = OPCODESIZE ( opcode );
if ( 1 < opSize )
{
sprintf ( modelStringBuffer, "%02X", operand1 );
return QVariant(modelStringBuffer);
sprintf ( m_modelStringBuffer, "%02X", operand1 );
return QVariant(m_modelStringBuffer);
}
break;
@@ -212,17 +210,17 @@ QVariant CCodeBrowserDisplayModel::data(const QModelIndex& index, int role) cons
if ( 2 < opSize )
{
sprintf ( modelStringBuffer, "%02X", operand2 );
return QVariant(modelStringBuffer);
sprintf ( m_modelStringBuffer, "%02X", operand2 );
return QVariant(m_modelStringBuffer);
}
break;
case CodeBrowserCol_Disassembly:
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
return nesGetDisassemblyAtAddress(addr);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
return c64GetDisassemblyAtAddress(addr);
}
@@ -249,11 +247,11 @@ QVariant CCodeBrowserDisplayModel::headerData(int section, Qt::Orientation orien
switch ( section )
{
case CodeBrowserCol_Address:
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
return "Address in 6502 memory space and (Mapper Bank:Offset)";
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
return "Address in 6502 memory space";
}
@@ -310,20 +308,20 @@ QVariant CCodeBrowserDisplayModel::headerData(int section, Qt::Orientation orien
QModelIndex CCodeBrowserDisplayModel::index(int row, int column, const QModelIndex&) const
{
int addr;
int physAddr;
if ( (row >= 0) && (column >= 0) )
{
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
addr = nesGetAddressFromSLOC(row);
physAddr = nesGetVirtualAddressFromSLOC(row);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
addr = c64GetAddressFromSLOC(row);
physAddr = c64GetAddressFromSLOC(row);
}
return createIndex(row, column, addr);
return createIndex(row, column, physAddr);
}
return QModelIndex();
@@ -333,12 +331,12 @@ int CCodeBrowserDisplayModel::rowCount(const QModelIndex&) const
{
unsigned int rows = 0;
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
// Get the source-lines-of-code count from RAM/SRAM/EXRAM/PRG-ROM that is currently visible to the CPU...
rows = nesGetSLOC(nesGetCPUProgramCounterOfLastSync());
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
// Get the source-lines-of-code count from RAM/SRAM/EXRAM/PRG-ROM that is currently visible to the CPU...
rows = c64GetSLOC(c64GetCPURegister(CPU_PC));
@@ -360,11 +358,11 @@ int CCodeBrowserDisplayModel::columnCount(const QModelIndex& parent) const
void CCodeBrowserDisplayModel::update()
{
// Update display...
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
nesDisassemble();
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
c64Disassemble();
}
@@ -32,7 +32,8 @@ public:
int columnCount(const QModelIndex& parent = QModelIndex()) const;
private:
CBreakpointInfo* m_pBreakpoints;
CBreakpointInfo *m_pBreakpoints;
char *m_modelStringBuffer;
public slots:
void update(void);
+1
View File
@@ -21,6 +21,7 @@ signals:
public slots:
void snapToHandler(QString item) {};
void applyEnvironmentSettings() {};
protected:
NesStateSnapshot m_nesState;
@@ -1,20 +1,20 @@
#include "cdebuggerbitfielddisplaymodel.h"
static char modelStringBuffer [ 2048 ];
CDebuggerBitfieldDisplayModel::CDebuggerBitfieldDisplayModel(regDBFunc regDB,QObject*)
{
m_regDB = regDB;
m_register = 0;
m_modelStringBuffer = new char[512];
}
CDebuggerBitfieldDisplayModel::~CDebuggerBitfieldDisplayModel()
{
delete [] m_modelStringBuffer;
}
QVariant CDebuggerBitfieldDisplayModel::data(const QModelIndex& index, int role) const
{
char* pValues = modelStringBuffer;
char* pValues = m_modelStringBuffer;
int value;
if (!index.isValid())
@@ -50,7 +50,7 @@ QVariant CDebuggerBitfieldDisplayModel::data(const QModelIndex& index, int role)
}
pValues += sprintf ( pValues, "</pre>" );
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
}
@@ -58,19 +58,19 @@ QVariant CDebuggerBitfieldDisplayModel::data(const QModelIndex& index, int role)
{
if ( pBitfield->GetNumValues() )
{
sprintf ( modelStringBuffer, "%s", pBitfield->GetValue(regData) );
sprintf ( m_modelStringBuffer, "%s", pBitfield->GetValue(regData) );
}
else
{
sprintf ( modelStringBuffer, pBitfield->GetDisplayFormat(), pBitfield->GetValueRaw(regData) );
sprintf ( m_modelStringBuffer, pBitfield->GetDisplayFormat(), pBitfield->GetValueRaw(regData) );
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
else if ( role == Qt::EditRole )
{
sprintf ( modelStringBuffer, pBitfield->GetDisplayFormat(), regData );
return QVariant(modelStringBuffer);
sprintf ( m_modelStringBuffer, pBitfield->GetDisplayFormat(), regData );
return QVariant(m_modelStringBuffer);
}
return QVariant();
@@ -91,7 +91,7 @@ QVariant CDebuggerBitfieldDisplayModel::headerData(int section, Qt::Orientation
if ( orientation == Qt::Horizontal )
{
sprintf ( modelStringBuffer, "Value" );
sprintf ( m_modelStringBuffer, "Value" );
}
else
{
@@ -101,16 +101,16 @@ QVariant CDebuggerBitfieldDisplayModel::headerData(int section, Qt::Orientation
if ( pBitfield->GetWidth() == 1 )
{
sprintf ( modelStringBuffer, "[%d] %s", pBitfield->GetLsb(), pBitfield->GetName() );
sprintf ( m_modelStringBuffer, "[%d] %s", pBitfield->GetLsb(), pBitfield->GetName() );
}
else
{
sprintf ( modelStringBuffer, "[%d:%d] %s", pBitfield->GetMsb(), pBitfield->GetLsb(), pBitfield->GetName() );
sprintf ( m_modelStringBuffer, "[%d:%d] %s", pBitfield->GetMsb(), pBitfield->GetLsb(), pBitfield->GetName() );
}
}
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
bool CDebuggerBitfieldDisplayModel::setData ( const QModelIndex& index, const QVariant& value, int )
@@ -29,8 +29,9 @@ public slots:
void update(void);
private:
regDBFunc m_regDB;
int m_register;
regDBFunc m_regDB;
int m_register;
char *m_modelStringBuffer;
};
#endif // CDEBUGGERBITFIELDDISPLAYMODEL_H
@@ -7,18 +7,18 @@
#include "ccodedatalogger.h"
static char modelStringBuffer [ 2048 ];
CDebuggerCodeProfilerModel::CDebuggerCodeProfilerModel(QObject *parent) :
QAbstractTableModel(parent)
{
m_currentSortColumn = CodeProfilerCol_Symbol;
m_currentSortOrder = Qt::DescendingOrder;
m_currentItemCount = 0;
m_modelStringBuffer = new char[32];
}
CDebuggerCodeProfilerModel::~CDebuggerCodeProfilerModel()
{
delete [] m_modelStringBuffer;
}
Qt::ItemFlags CDebuggerCodeProfilerModel::flags(const QModelIndex& index) const
@@ -39,8 +39,8 @@ QModelIndex CDebuggerCodeProfilerModel::index(int row, int column, const QModelI
unsigned int addr;
unsigned int absAddr;
addr = CCC65Interface::getSymbolAddress(m_items.at(row).symbol);
absAddr = CCC65Interface::getSymbolAbsoluteAddress(m_items.at(row).symbol);
addr = CCC65Interface::instance()->getSymbolAddress(m_items.at(row).symbol);
absAddr = CCC65Interface::instance()->getSymbolPhysicalAddress(m_items.at(row).symbol);
if ( addr >= MEM_32KB )
{
@@ -128,7 +128,7 @@ int CDebuggerCodeProfilerModel::columnCount(const QModelIndex&) const
void CDebuggerCodeProfilerModel::update()
{
QStringList symbols = CCC65Interface::getSymbolsForSourceFile(""); // CPTODO: File doesn't matter (yet).
QStringList symbols = CCC65Interface::instance()->getSymbolsForSourceFile(""); // CPTODO: File doesn't matter (yet).
CCodeDataLogger* pLogger;
unsigned int addr;
unsigned int absAddr;
@@ -141,8 +141,8 @@ void CDebuggerCodeProfilerModel::update()
// CPTODO: Temporary hack to get around temporary labels.
if ( !symbol.startsWith('@') )
{
addr = CCC65Interface::getSymbolAddress(symbol);
absAddr = CCC65Interface::getSymbolAbsoluteAddress(symbol);
addr = CCC65Interface::instance()->getSymbolAddress(symbol);
absAddr = CCC65Interface::instance()->getSymbolPhysicalAddress(symbol);
if ( absAddr != -1 )
{
@@ -170,12 +170,12 @@ void CDebuggerCodeProfilerModel::update()
(pLogger->GetType(addr&mask) == eLogger_InstructionFetch) )
{
item.symbol = symbol;
item.size = CCC65Interface::getSymbolSize(symbol);
item.file = CCC65Interface::getSourceFileFromSymbol(symbol);
item.size = CCC65Interface::instance()->getSymbolSize(symbol);
item.file = CCC65Interface::instance()->getSourceFileFromSymbol(symbol);
fileInfo.setFile(item.file);
nesGetPrintableAddressWithAbsolute(modelStringBuffer,addr,absAddr);
item.address = modelStringBuffer;
nesGetPrintablePhysicalAddress(m_modelStringBuffer,addr,absAddr);
item.address = m_modelStringBuffer;
item.count = pLogger->GetCount(addr&mask);
if ( !m_items.contains(item) )
{
@@ -57,10 +57,11 @@ public slots:
void sort(int column, Qt::SortOrder order);
private:
QList<ProfiledItem> m_items;
int m_currentSortColumn;
Qt::SortOrder m_currentSortOrder;
int m_currentItemCount;
QList<ProfiledItem> m_items;
int m_currentSortColumn;
Qt::SortOrder m_currentSortOrder;
int m_currentItemCount;
char *m_modelStringBuffer;
};
#endif // CDEBUGGERCODEPROFILERMODEL_H
@@ -3,8 +3,6 @@
#include "dbg_cnes.h"
#include "dbg_cnes6502.h"
static char modelStringBuffer [ 2048 ];
void GetPrintable ( TracerInfo* pSample, int subItem, char* str );
CDebuggerExecutionTracerModel::CDebuggerExecutionTracerModel(QObject*)
@@ -12,10 +10,12 @@ CDebuggerExecutionTracerModel::CDebuggerExecutionTracerModel(QObject*)
m_pTracer = nesGetExecutionTracerDatabase();
m_bShowCPU = true;
m_bShowPPU = true;
m_modelStringBuffer = new char[256];
}
CDebuggerExecutionTracerModel::~CDebuggerExecutionTracerModel()
{
delete [] m_modelStringBuffer;
}
QVariant CDebuggerExecutionTracerModel::data(const QModelIndex& index, int role) const
@@ -30,9 +30,9 @@ QVariant CDebuggerExecutionTracerModel::data(const QModelIndex& index, int role)
return QVariant();
}
GetPrintable((TracerInfo*)index.internalPointer(), index.column(), modelStringBuffer);
GetPrintable((TracerInfo*)index.internalPointer(), index.column(), m_modelStringBuffer);
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
Qt::ItemFlags CDebuggerExecutionTracerModel::flags(const QModelIndex&) const
@@ -25,9 +25,10 @@ public slots:
void update();
private:
CTracer* m_pTracer;
bool m_bShowCPU;
bool m_bShowPPU;
CTracer *m_pTracer;
bool m_bShowCPU;
bool m_bShowPPU;
char *m_modelStringBuffer;
};
#endif // CDEBUGGEREXECUTIONTRACERMODEL_H
@@ -3,73 +3,67 @@
#include <QColor>
#include <QBrush>
static char modelStringBuffer [ 2048 ];
CDebuggerMemoryDisplayModel::CDebuggerMemoryDisplayModel(memDBFunc memDB,QObject*)
{
m_memDB = memDB;
m_modelStringBuffer = new char[256];
m_memDBFunc = memDB;
m_memDB = memDB();
}
CDebuggerMemoryDisplayModel::~CDebuggerMemoryDisplayModel()
{
delete [] m_modelStringBuffer;
}
int CDebuggerMemoryDisplayModel::memoryType() const
{
CMemoryDatabase* memDB = m_memDB();
if ( memDB )
if ( m_memDB )
{
return memDB->GetType();
return m_memDB->GetType();
}
return 0;
}
int CDebuggerMemoryDisplayModel::memoryBottom() const
{
CMemoryDatabase* memDB = m_memDB();
if ( memDB )
if ( m_memDB )
{
return memDB->GetBase();
return m_memDB->GetBase();
}
return 0;
}
int CDebuggerMemoryDisplayModel::memoryTop() const
{
CMemoryDatabase* memDB = m_memDB();
if ( memDB )
if ( m_memDB )
{
return memDB->GetBase()+memDB->GetSize()-1;
return m_memDB->GetBase()+m_memDB->GetSize()-1;
}
return 0;
}
QVariant CDebuggerMemoryDisplayModel::data(const QModelIndex& index, int role) const
{
CMemoryDatabase* memDB = m_memDB();
if (!index.isValid())
{
return QVariant();
}
if ( memDB )
if ( m_memDB )
{
if (role == Qt::BackgroundRole)
{
return QBrush(QColor(memDB->GetCellRedComponent(memDB->Get((index.row()*memDB->GetNumColumns())+index.column())),
memDB->GetCellGreenComponent(memDB->Get((index.row()*memDB->GetNumColumns())+index.column())),
memDB->GetCellBlueComponent(memDB->Get((index.row()*memDB->GetNumColumns())+index.column()))));
return QBrush(QColor(m_memDB->GetCellRedComponent(m_memDB->Get((index.row()*m_memDB->GetNumColumns())+index.column())),
m_memDB->GetCellGreenComponent(m_memDB->Get((index.row()*m_memDB->GetNumColumns())+index.column())),
m_memDB->GetCellBlueComponent(m_memDB->Get((index.row()*m_memDB->GetNumColumns())+index.column()))));
}
if (role == Qt::ForegroundRole)
{
QColor col = QColor(memDB->GetCellRedComponent(memDB->Get((index.row()*memDB->GetNumColumns())+index.column())),
memDB->GetCellGreenComponent(memDB->Get((index.row()*memDB->GetNumColumns())+index.column())),
memDB->GetCellBlueComponent(memDB->Get((index.row()*memDB->GetNumColumns())+index.column())));
QColor col = QColor(m_memDB->GetCellRedComponent(m_memDB->Get((index.row()*m_memDB->GetNumColumns())+index.column())),
m_memDB->GetCellGreenComponent(m_memDB->Get((index.row()*m_memDB->GetNumColumns())+index.column())),
m_memDB->GetCellBlueComponent(m_memDB->Get((index.row()*m_memDB->GetNumColumns())+index.column())));
if ((((double)col.red() +
(double)col.green() +
@@ -89,25 +83,25 @@ QVariant CDebuggerMemoryDisplayModel::data(const QModelIndex& index, int role) c
return QVariant();
}
if ( memDB )
if ( m_memDB )
{
sprintf(modelStringBuffer,"%02X",memDB->Get((index.row()*memDB->GetNumColumns())+index.column()));
sprintf(m_modelStringBuffer,"%02X",m_memDB->Get((index.row()*m_memDB->GetNumColumns())+index.column()));
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
Qt::ItemFlags CDebuggerMemoryDisplayModel::flags(const QModelIndex& /*index*/) const
{
Qt::ItemFlags flags = Qt::ItemIsEnabled;
if ( m_memDB() )
if ( m_memDB )
{
if ( m_memDB()->GetCellsEditable() )
if ( m_memDB->GetCellsEditable() )
{
flags |= Qt::ItemIsEditable;
}
if ( m_memDB()->GetCellsSelectable() )
if ( m_memDB->GetCellsSelectable() )
{
flags |= Qt::ItemIsSelectable;
}
@@ -125,17 +119,17 @@ QVariant CDebuggerMemoryDisplayModel::headerData(int section, Qt::Orientation or
if ( orientation == Qt::Horizontal )
{
sprintf ( modelStringBuffer, "x%1X", section );
sprintf ( m_modelStringBuffer, "x%1X", section );
}
else
{
if ( m_memDB() )
if ( m_memDB )
{
m_memDB()->GetRowHeading(modelStringBuffer,m_memDB()->GetBase()+(section*m_memDB()->GetNumColumns()));
m_memDB->GetRowHeading(m_modelStringBuffer,m_memDB->GetBase()+(section*m_memDB->GetNumColumns()));
}
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
bool CDebuggerMemoryDisplayModel::setData ( const QModelIndex& index, const QVariant& value, int )
@@ -143,13 +137,13 @@ bool CDebuggerMemoryDisplayModel::setData ( const QModelIndex& index, const QVar
unsigned int data;
bool ok = false;
if ( m_memDB() )
if ( m_memDB )
{
data = value.toString().toInt(&ok,16);
if ( ok )
{
m_memDB()->Set((index.row()*m_memDB()->GetNumColumns())+index.column(),data);
m_memDB->Set((index.row()*m_memDB->GetNumColumns())+index.column(),data);
emit dataChanged(index,index);
}
}
@@ -159,11 +153,11 @@ bool CDebuggerMemoryDisplayModel::setData ( const QModelIndex& index, const QVar
QModelIndex CDebuggerMemoryDisplayModel::index(int row, int column, const QModelIndex&) const
{
if ( m_memDB() )
if ( m_memDB )
{
if ( (row >= 0) && (column >= 0) )
{
return createIndex(row,column,m_memDB());
return createIndex(row,column,m_memDB);
}
}
@@ -172,9 +166,9 @@ QModelIndex CDebuggerMemoryDisplayModel::index(int row, int column, const QModel
int CDebuggerMemoryDisplayModel::rowCount(const QModelIndex&) const
{
if ( m_memDB() )
if ( m_memDB )
{
return m_memDB()->GetNumRows();
return m_memDB->GetNumRows();
}
return 0;
@@ -182,9 +176,9 @@ int CDebuggerMemoryDisplayModel::rowCount(const QModelIndex&) const
int CDebuggerMemoryDisplayModel::columnCount(const QModelIndex& /*parent*/) const
{
if ( m_memDB() )
if ( m_memDB )
{
return m_memDB()->GetNumColumns();
return m_memDB->GetNumColumns();
}
return 0;
@@ -192,5 +186,6 @@ int CDebuggerMemoryDisplayModel::columnCount(const QModelIndex& /*parent*/) cons
void CDebuggerMemoryDisplayModel::update()
{
m_memDB = m_memDBFunc();
emit dataChanged(QModelIndex(),QModelIndex());
}
@@ -29,7 +29,9 @@ public slots:
void update(void);
private:
memDBFunc m_memDB;
memDBFunc m_memDBFunc;
CMemoryDatabase *m_memDB;
char *m_modelStringBuffer;
};
#endif // CDEBUGGERMEMORYDISPLAYMODEL_H
@@ -1,45 +1,40 @@
#include "cdebuggerregisterdisplaymodel.h"
static char modelStringBuffer [ 2048 ];
CDebuggerRegisterDisplayModel::CDebuggerRegisterDisplayModel(regDBFunc regDB,QObject*)
{
m_regDB = regDB;
m_regDBFunc = regDB;
m_regDB = regDB();
m_modelStringBuffer = new char[128];
}
CDebuggerRegisterDisplayModel::~CDebuggerRegisterDisplayModel()
{
delete [] m_modelStringBuffer;
}
int CDebuggerRegisterDisplayModel::memoryType() const
{
CRegisterDatabase* regDB = m_regDB();
if ( regDB )
if ( m_regDB )
{
return regDB->GetType();
return m_regDB->GetType();
}
return 0;
}
bool CDebuggerRegisterDisplayModel::memoryContains(uint32_t addr) const
{
CRegisterDatabase* regDB = m_regDB();
if ( regDB )
if ( m_regDB )
{
return regDB->Contains(addr);
return m_regDB->Contains(addr);
}
return false;
}
int CDebuggerRegisterDisplayModel::memoryBottom() const
{
CRegisterDatabase* regDB = m_regDB();
if ( regDB )
if ( m_regDB )
{
return regDB->GetRegister(0)->GetAddr();
return m_regDB->GetRegister(0)->GetAddr();
}
return 0;
}
@@ -59,10 +54,10 @@ QVariant CDebuggerRegisterDisplayModel::data(const QModelIndex& index, int role)
if ( pRegister )
{
sprintf ( modelStringBuffer, "%02X", (int)pRegister->Get() );
sprintf ( m_modelStringBuffer, "%02X", (int)pRegister->Get() );
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
Qt::ItemFlags CDebuggerRegisterDisplayModel::flags(const QModelIndex& /*index*/) const
@@ -79,27 +74,27 @@ QVariant CDebuggerRegisterDisplayModel::headerData(int section, Qt::Orientation
return QVariant();
}
if ( m_regDB() )
if (m_regDB )
{
if ( orientation == Qt::Horizontal )
{
if ( (section >= 0) &&
(section < m_regDB()->GetNumColumns()) )
(section <m_regDB->GetNumColumns()) )
{
sprintf(modelStringBuffer,m_regDB()->GetColumnHeading(section));
sprintf(m_modelStringBuffer,m_regDB->GetColumnHeading(section));
}
}
else
{
if ( (section >= 0) &&
(section < m_regDB()->GetNumRows()) )
(section < m_regDB->GetNumRows()) )
{
sprintf(modelStringBuffer,m_regDB()->GetRowHeading(section));
sprintf(m_modelStringBuffer,m_regDB->GetRowHeading(section));
}
}
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
bool CDebuggerRegisterDisplayModel::setData ( const QModelIndex& index, const QVariant& value, int )
@@ -107,13 +102,13 @@ bool CDebuggerRegisterDisplayModel::setData ( const QModelIndex& index, const QV
unsigned int data;
bool ok = false;
if ( m_regDB() )
if ( m_regDB )
{
data = value.toString().toInt(&ok,16);
if ( ok )
{
m_regDB()->GetRegister((index.row()*m_regDB()->GetNumColumns())+index.column())->Set(data);
m_regDB->GetRegister((index.row()*m_regDB->GetNumColumns())+index.column())->Set(data);
emit dataChanged(index,index);
}
}
@@ -123,12 +118,12 @@ bool CDebuggerRegisterDisplayModel::setData ( const QModelIndex& index, const QV
QModelIndex CDebuggerRegisterDisplayModel::index(int row, int column, const QModelIndex&) const
{
if ( m_regDB() )
if ( m_regDB )
{
if ( (row >= 0) && (column >= 0) &&
(row < m_regDB()->GetNumRows()) && (column < m_regDB()->GetNumColumns()) )
(row < m_regDB->GetNumRows()) && (column < m_regDB->GetNumColumns()) )
{
return createIndex(row,column,m_regDB()->GetRegister((row*m_regDB()->GetNumColumns())+column));
return createIndex(row,column,m_regDB->GetRegister((row*m_regDB->GetNumColumns())+column));
}
}
@@ -137,9 +132,9 @@ QModelIndex CDebuggerRegisterDisplayModel::index(int row, int column, const QMod
int CDebuggerRegisterDisplayModel::rowCount(const QModelIndex& /*parent*/) const
{
if ( m_regDB() )
if ( m_regDB )
{
return m_regDB()->GetNumRows();
return m_regDB->GetNumRows();
}
return 0;
@@ -147,9 +142,9 @@ int CDebuggerRegisterDisplayModel::rowCount(const QModelIndex& /*parent*/) const
int CDebuggerRegisterDisplayModel::columnCount(const QModelIndex& /*parent*/) const
{
if ( m_regDB() )
if ( m_regDB )
{
return m_regDB()->GetNumColumns();
return m_regDB->GetNumColumns();
}
return 0;
@@ -157,5 +152,6 @@ int CDebuggerRegisterDisplayModel::columnCount(const QModelIndex& /*parent*/) co
void CDebuggerRegisterDisplayModel::update()
{
m_regDB = m_regDBFunc();
emit layoutChanged();
}
@@ -29,7 +29,9 @@ public slots:
void update(void);
private:
regDBFunc m_regDB;
regDBFunc m_regDBFunc;
CRegisterDatabase *m_regDB;
char *m_modelStringBuffer;
};
#endif // CDEBUGGERREGISTERDISPLAYMODEL_H
@@ -23,7 +23,7 @@ void CDebuggerSymbolDelegate::setEditorData(QWidget* editor,
const QModelIndex& index) const
{
QLineEdit* edit = static_cast<QLineEdit*>(editor);
QStringList symbols = CCC65Interface::getSymbolsForSourceFile("<CPTODO:fixme>");
QStringList symbols = CCC65Interface::instance()->getSymbolsForSourceFile("<CPTODO:fixme>");
QCompleter* completer = new QCompleter(symbols);
completer->setCompletionMode(QCompleter::PopupCompletion);
completer->setCompletionPrefix(index.data(Qt::DisplayRole).toString());
@@ -5,8 +5,6 @@
#include "cmarker.h"
#include "nes_emulator_core.h"
static char modelStringBuffer [ 2048 ];
static const char* MARKER_NOT_STARTED = "No start set";
static const char* MARKER_NOT_COMPLETED = "No end set";
static const char* MARKER_NO_DATA = "No data";
@@ -14,10 +12,12 @@ static const char* MARKER_NO_DATA = "No data";
CExecutionMarkerDisplayModel::CExecutionMarkerDisplayModel(QObject *parent) :
QAbstractTableModel(parent)
{
m_modelStringBuffer = new char[32];
}
CExecutionMarkerDisplayModel::~CExecutionMarkerDisplayModel()
{
delete [] m_modelStringBuffer;
}
Qt::ItemFlags CExecutionMarkerDisplayModel::flags(const QModelIndex& index) const
@@ -66,13 +66,13 @@ QVariant CExecutionMarkerDisplayModel::data(const QModelIndex& index, int role)
if ( (pMarker->startCpuCycle != MARKER_NOT_MARKED) &&
(pMarker->endCpuCycle == MARKER_NOT_MARKED) )
{
sprintf(modelStringBuffer,"%d",nesGetCPUCycle()-pMarker->startCpuCycle);
sprintf(m_modelStringBuffer,"%d",nesGetCPUCycle()-pMarker->startCpuCycle);
}
else
{
sprintf(modelStringBuffer,"%d",pMarker->curCpuCycles);
sprintf(m_modelStringBuffer,"%d",pMarker->curCpuCycles);
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
else
{
@@ -84,13 +84,13 @@ QVariant CExecutionMarkerDisplayModel::data(const QModelIndex& index, int role)
{
if ( pMarker->minCpuCycles == 0xFFFFFFFF )
{
sprintf(modelStringBuffer,"N/A");
sprintf(m_modelStringBuffer,"N/A");
}
else
{
sprintf(modelStringBuffer,"%d",pMarker->minCpuCycles);
sprintf(m_modelStringBuffer,"%d",pMarker->minCpuCycles);
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
else
{
@@ -102,13 +102,13 @@ QVariant CExecutionMarkerDisplayModel::data(const QModelIndex& index, int role)
{
if ( pMarker->maxCpuCycles == 0 )
{
sprintf(modelStringBuffer,"N/A");
sprintf(m_modelStringBuffer,"N/A");
}
else
{
sprintf(modelStringBuffer,"%d",pMarker->maxCpuCycles);
sprintf(m_modelStringBuffer,"%d",pMarker->maxCpuCycles);
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
else
{
@@ -118,10 +118,10 @@ QVariant CExecutionMarkerDisplayModel::data(const QModelIndex& index, int role)
case ExecutionVisualizerCol_StartAddr:
if ( pMarker->state >= eMarkerSet_Started )
{
nesGetPrintableAddressWithAbsolute(modelStringBuffer,
nesGetPrintablePhysicalAddress(m_modelStringBuffer,
pMarker->startAddr,
pMarker->startAbsAddr);
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
else
{
@@ -131,10 +131,10 @@ QVariant CExecutionMarkerDisplayModel::data(const QModelIndex& index, int role)
case ExecutionVisualizerCol_EndAddr:
if ( pMarker->state >= eMarkerSet_Complete )
{
nesGetPrintableAddressWithAbsolute(modelStringBuffer,
nesGetPrintablePhysicalAddress(m_modelStringBuffer,
pMarker->endAddr,
pMarker->endAbsAddr);
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
else
{
@@ -31,6 +31,7 @@ public slots:
void update();
private:
char *m_modelStringBuffer;
};
#endif // CEXECUTIONMARKERDISPLAYMODEL_H
+93 -40
View File
@@ -29,6 +29,16 @@ CodeBrowserDockWidget::CodeBrowserDockWidget(CBreakpointInfo* pBreakpoints,QWidg
assemblyViewModel = new CCodeBrowserDisplayModel(pBreakpoints,this);
ui->tableView->setModel(assemblyViewModel);
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
setFont(QFont("Monaco", 11));
#endif
#ifdef Q_OS_LINUX
setFont(QFont("Monospace", 10));
#endif
#ifdef Q_OS_WIN
setFont(QFont("Consolas", 11));
#endif
QObject::connect ( this, SIGNAL(breakpointsChanged()), assemblyViewModel, SLOT(update()) );
}
@@ -40,16 +50,15 @@ CodeBrowserDockWidget::~CodeBrowserDockWidget()
void CodeBrowserDockWidget::updateTargetMachine(QString target)
{
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), assemblyViewModel, SLOT(update()) );
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), this, SLOT(breakpointHit()) );
m_loadedTarget = target;
if ( emulator )
if ( target.compare("none") )
{
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), assemblyViewModel, SLOT(update()) );
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), this, SLOT(breakpointHit()) );
QObject::connect ( emulator, SIGNAL(machineReady()), assemblyViewModel, SLOT(update()));
QObject::connect ( emulator, SIGNAL(emulatorReset()), assemblyViewModel, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), assemblyViewModel, SLOT(update()) );
@@ -60,15 +69,15 @@ void CodeBrowserDockWidget::updateTargetMachine(QString target)
void CodeBrowserDockWidget::showEvent(QShowEvent* /*e*/)
{
QDockWidget* breakpointInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Breakpoints"));
QDockWidget* executionVisualizer = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Execution Visualizer"));
QObject* emulator = CObjectRegistry::getObject("Emulator");
QDockWidget* breakpointInspector = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Breakpoints"));
QDockWidget* executionVisualizer = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Execution Visualizer"));
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
// Specifically not connecting to updateDebuggers signal here since it doesn't make much sense to
// update the code position until a pause/breakpoint.
if ( emulator )
{
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), this, SLOT(emulatorPaused(bool)) );
// QObject::connect ( emulator, SIGNAL(updateDebuggers()), this, SLOT(updateDebuggers()) );
}
QObject::connect ( breakpointInspector, SIGNAL(breakpointsChanged()), assemblyViewModel, SLOT(update()) );
QObject::connect ( breakpointInspector, SIGNAL(snapTo(QString)), this, SLOT(snapTo(QString)) );
@@ -91,11 +100,11 @@ void CodeBrowserDockWidget::showEvent(QShowEvent* /*e*/)
void CodeBrowserDockWidget::hideEvent(QHideEvent* /*e*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
QObject::disconnect ( emulator, SIGNAL(emulatorPaused(bool)), this, SLOT(emulatorPaused(bool)) );
// QObject::disconnect ( emulator, SIGNAL(updateDebuggers()), this, SLOT(updateDebuggers()) );
}
}
@@ -104,18 +113,18 @@ void CodeBrowserDockWidget::contextMenuEvent(QContextMenuEvent* e)
QMenu menu;
int bp;
int addr = 0;
int absAddr = 0;
int physAddr = 0;
QModelIndex index = ui->tableView->currentIndex();
if ( !m_loadedTarget.compare("nes",Qt::CaseInsensitive) )
{
addr = nesGetAddressFromSLOC(index.row());
absAddr = nesGetAbsoluteAddressFromAddress(addr);
addr = nesGetVirtualAddressFromSLOC(index.row());
physAddr = nesGetPhysicalAddressFromAddress(addr);
}
else if ( !m_loadedTarget.compare("c64",Qt::CaseInsensitive) )
{
addr = c64GetAddressFromSLOC(index.row());
absAddr = c64GetAbsoluteAddressFromAddress(addr);
physAddr = c64GetPhysicalAddressFromAddress(addr);
}
if ( addr != -1 )
@@ -127,7 +136,7 @@ void CodeBrowserDockWidget::contextMenuEvent(QContextMenuEvent* e)
eBreakpointItemAddress,
0,
addr,
absAddr,
physAddr,
addr,
0xFFFF,
true,
@@ -166,6 +175,8 @@ void CodeBrowserDockWidget::contextMenuEvent(QContextMenuEvent* e)
menu.addAction(ui->actionStart_marker_here);
menu.addAction(ui->actionEnd_marker_here);
menu.addAction(ui->actionStart_End_marker_here);
// Run the context menu...
// CPTODO: Hokey trick to provide the breakpoint-of-interest to action handlers...
m_breakpointIndex = bp;
@@ -222,7 +233,7 @@ void CodeBrowserDockWidget::snapTo(QString item)
{
ui->tableView->setCurrentIndex(assemblyViewModel->index(c64GetSLOCFromAddress(addr),0));
}
ui->tableView->scrollTo(ui->tableView->currentIndex());
ui->tableView->scrollTo(ui->tableView->currentIndex(),QAbstractItemView::PositionAtTop);
ui->tableView->resizeColumnsToContents();
}
}
@@ -286,17 +297,17 @@ void CodeBrowserDockWidget::on_actionBreak_on_CPU_execution_here_triggered()
QModelIndex index = ui->tableView->currentIndex();
int bpIdx;
int addr = 0;
int absAddr = 0;
int physAddr = 0;
if ( !m_loadedTarget.compare("nes",Qt::CaseInsensitive) )
{
addr = nesGetAddressFromSLOC(index.row());
absAddr = nesGetAbsoluteAddressFromAddress(addr);
addr = nesGetVirtualAddressFromSLOC(index.row());
physAddr = nesGetPhysicalAddressFromAddress(addr);
}
else if ( !m_loadedTarget.compare("c64",Qt::CaseInsensitive) )
{
addr = c64GetAddressFromSLOC(index.row());
absAddr = c64GetAbsoluteAddressFromAddress(addr);
physAddr = c64GetPhysicalAddressFromAddress(addr);
}
if ( addr != -1 )
@@ -305,10 +316,10 @@ void CodeBrowserDockWidget::on_actionBreak_on_CPU_execution_here_triggered()
eBreakpointItemAddress,
0,
addr,
absAddr,
physAddr,
addr,
0xFFFF,
false,
true,
eBreakpointConditionNone,
0,
eBreakpointDataNone,
@@ -333,12 +344,12 @@ void CodeBrowserDockWidget::on_actionRun_to_here_triggered()
{
QModelIndex index = ui->tableView->currentIndex();
int addr = 0;
int absAddr = 0;
int physAddr = 0;
if ( !m_loadedTarget.compare("nes",Qt::CaseInsensitive) )
{
addr = nesGetAddressFromSLOC(index.row());
absAddr = nesGetAbsoluteAddressFromAddress(addr);
addr = nesGetVirtualAddressFromSLOC(index.row());
physAddr = nesGetPhysicalAddressFromAddress(addr);
if ( addr != -1 )
{
nesSetGotoAddress(addr);
@@ -347,7 +358,7 @@ void CodeBrowserDockWidget::on_actionRun_to_here_triggered()
else if ( !m_loadedTarget.compare("c64",Qt::CaseInsensitive) )
{
addr = c64GetAddressFromSLOC(index.row());
absAddr = c64GetAbsoluteAddressFromAddress(addr);
physAddr = c64GetPhysicalAddressFromAddress(addr);
if ( addr != -1 )
{
c64SetGotoAddress(addr);
@@ -388,6 +399,48 @@ void CodeBrowserDockWidget::on_actionEnable_breakpoint_triggered()
}
}
void CodeBrowserDockWidget::on_actionStart_End_marker_here_triggered()
{
CMarker* markers = nesGetExecutionMarkerDatabase();
QModelIndexList indexes = ui->tableView->selectionModel()->selectedRows();
int marker = -1;
int line, lineFrom, lineTo, indexFrom, indexTo;
int addr = 0;
int absAddr = 0;
lineFrom = indexes[0].row();
lineTo = indexes[indexes.count()-1].row();
if ( lineFrom != -1 )
{
// nesGetAddrFromSLOC(lineFrom);
// if ( addr != -1 )
// {
// // Find unused Marker entry...
// marker = markers->AddMarker(addr,absAddr);
// emit breakpointsChanged();
// emit markProjectDirty(true);
// }
}
if ( lineTo != -1 )
{
// if ( marker >= 0 )
// {
// resolveLineAddress(lineTo,&addr,&absAddr);
// if ( addr != -1 )
// {
// markers->CompleteMarker(marker,addr,absAddr);
// emit breakpointsChanged();
// emit markProjectDirty(true);
// }
// }
}
}
void CodeBrowserDockWidget::on_actionStart_marker_here_triggered()
{
CMarker* markers = nesGetExecutionMarkerDatabase();
@@ -399,7 +452,7 @@ void CodeBrowserDockWidget::on_actionStart_marker_here_triggered()
{
if ( !m_loadedTarget.compare("nes",Qt::CaseInsensitive) )
{
addr = nesGetAddressFromSLOC(index.row());
addr = nesGetVirtualAddressFromSLOC(index.row());
}
else if ( !m_loadedTarget.compare("c64",Qt::CaseInsensitive) )
{
@@ -411,11 +464,11 @@ void CodeBrowserDockWidget::on_actionStart_marker_here_triggered()
// Find unused Marker entry...
if ( !m_loadedTarget.compare("nes",Qt::CaseInsensitive) )
{
marker = markers->AddMarker(addr,nesGetAbsoluteAddressFromAddress(addr));
marker = markers->AddMarker(addr,nesGetPhysicalAddressFromAddress(addr));
}
else if ( !m_loadedTarget.compare("c64",Qt::CaseInsensitive) )
{
marker = markers->AddMarker(addr,c64GetAbsoluteAddressFromAddress(addr));
marker = markers->AddMarker(addr,c64GetPhysicalAddressFromAddress(addr));
}
emit breakpointsChanged();
@@ -435,7 +488,7 @@ void CodeBrowserDockWidget::on_actionEnd_marker_here_triggered()
{
if ( !m_loadedTarget.compare("nes",Qt::CaseInsensitive) )
{
addr = nesGetAddressFromSLOC(index.row());
addr = nesGetVirtualAddressFromSLOC(index.row());
}
else if ( !m_loadedTarget.compare("c64",Qt::CaseInsensitive) )
{
@@ -446,11 +499,11 @@ void CodeBrowserDockWidget::on_actionEnd_marker_here_triggered()
{
if ( !m_loadedTarget.compare("nes",Qt::CaseInsensitive) )
{
markers->CompleteMarker(marker,addr,nesGetAbsoluteAddressFromAddress(addr));
markers->CompleteMarker(marker,addr,nesGetPhysicalAddressFromAddress(addr));
}
else if ( !m_loadedTarget.compare("c64",Qt::CaseInsensitive) )
{
markers->CompleteMarker(marker,addr,c64GetAbsoluteAddressFromAddress(addr));
markers->CompleteMarker(marker,addr,c64GetPhysicalAddressFromAddress(addr));
}
emit breakpointsChanged();
@@ -472,7 +525,7 @@ void CodeBrowserDockWidget::on_tableView_pressed(QModelIndex index)
{
int bp;
int addr = 0;
int absAddr = 0;
int physAddr = 0;
if ( QApplication::mouseButtons() == Qt::LeftButton )
{
@@ -480,13 +533,13 @@ void CodeBrowserDockWidget::on_tableView_pressed(QModelIndex index)
{
if ( !m_loadedTarget.compare("nes",Qt::CaseInsensitive) )
{
addr = nesGetAddressFromSLOC(index.row());
absAddr = nesGetAbsoluteAddressFromAddress(addr);
addr = nesGetVirtualAddressFromSLOC(index.row());
physAddr = nesGetPhysicalAddressFromAddress(addr);
}
else if ( !m_loadedTarget.compare("c64",Qt::CaseInsensitive) )
{
addr = c64GetAddressFromSLOC(index.row());
absAddr = c64GetAbsoluteAddressFromAddress(addr);
physAddr = c64GetPhysicalAddressFromAddress(addr);
}
if ( addr != -1 )
@@ -495,7 +548,7 @@ void CodeBrowserDockWidget::on_tableView_pressed(QModelIndex index)
eBreakpointItemAddress,
0,
addr,
absAddr,
physAddr,
addr,
0xFFFF,
true,
@@ -55,6 +55,7 @@ private slots:
void on_actionRun_to_here_triggered();
void on_actionBreak_on_CPU_execution_here_triggered();
void on_actionStart_marker_here_triggered();
void on_actionStart_End_marker_here_triggered();
void on_actionEnd_marker_here_triggered();
void on_actionClear_marker_triggered();
};
+24 -7
View File
@@ -24,7 +24,16 @@
</property>
<widget class="QWidget" name="dockWidgetContents">
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="spacing">
@@ -51,7 +60,7 @@
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
<enum>QAbstractItemView::ContiguousSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
@@ -83,12 +92,12 @@
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>50</number>
</attribute>
<attribute name="horizontalHeaderMinimumSectionSize">
<number>26</number>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>50</number>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
@@ -98,10 +107,10 @@
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<attribute name="verticalHeaderMinimumSectionSize">
<number>23</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<attribute name="verticalHeaderDefaultSectionSize">
<number>23</number>
</attribute>
</widget>
@@ -180,6 +189,14 @@
<string>Go to Source</string>
</property>
</action>
<action name="actionStart_End_marker_here">
<property name="text">
<string>Set Visualization Marker on selected region</string>
</property>
<property name="toolTip">
<string>Set Visualization Marker on selected region</string>
</property>
</action>
</widget>
<resources/>
<connections/>
+18 -10
View File
@@ -6,7 +6,6 @@
#include "ccodedatalogger.h"
#include "cobjectregistry.h"
#include "main.h"
CodeProfilerDockWidget::CodeProfilerDockWidget(QWidget *parent) :
CDebuggerBase(parent),
@@ -20,8 +19,17 @@ CodeProfilerDockWidget::CodeProfilerDockWidget(QWidget *parent) :
ui->tableView->sortByColumn(CodeProfilerCol_Calls,Qt::DescendingOrder);
QObject::connect(ui->tableView->horizontalHeader(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),model,SLOT(sort(int,Qt::SortOrder)));
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
ui->tableView->setFont(QFont("Monaco", 11));
#endif
#ifdef Q_OS_LINUX
ui->tableView->setFont(QFont("Monospace", 10));
#endif
#ifdef Q_OS_WIN
ui->tableView->setFont(QFont("Consolas", 11));
#endif
QObject::connect(ui->tableView->horizontalHeader(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),model,SLOT(sort(int,Qt::SortOrder)));
QObject::connect(model,SIGNAL(layoutChanged()),this,SLOT(updateUi()));
}
@@ -30,14 +38,14 @@ CodeProfilerDockWidget::~CodeProfilerDockWidget()
delete ui;
}
void CodeProfilerDockWidget::updateTargetMachine(QString /*target*/)
void CodeProfilerDockWidget::updateTargetMachine(QString target)
{
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),model,SLOT(update()));
if ( emulator )
if ( target.compare("none") )
{
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),model,SLOT(update()));
QObject::connect(emulator,SIGNAL(machineReady()),this,SLOT(on_clear_clicked()));
QObject::connect(emulator,SIGNAL(emulatorReset()),model,SLOT(update()));
QObject::connect(emulator,SIGNAL(emulatorPaused(bool)),model,SLOT(update()));
@@ -46,7 +54,7 @@ void CodeProfilerDockWidget::updateTargetMachine(QString /*target*/)
void CodeProfilerDockWidget::showEvent(QShowEvent */*event*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
@@ -57,7 +65,7 @@ void CodeProfilerDockWidget::showEvent(QShowEvent */*event*/)
void CodeProfilerDockWidget::hideEvent(QHideEvent */*event*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
+6 -4
View File
@@ -69,7 +69,7 @@
<bool>false</bool>
</property>
<attribute name="horizontalHeaderVisible">
<bool>true</bool>
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>false</bool>
@@ -86,16 +86,19 @@
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<attribute name="verticalHeaderMinimumSectionSize">
<number>23</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<attribute name="verticalHeaderDefaultSectionSize">
<number>23</number>
</attribute>
</widget>
</item>
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
@@ -134,7 +137,6 @@
</widget>
<resources>
<include location="../../../common/resource.qrc"/>
<include location="../../../common/resource.qrc"/>
</resources>
<connections/>
</ui>
+22 -22
View File
@@ -5,8 +5,6 @@
#include "ccc65interface.h"
#include "nes_emulator_core.h"
static char modelStringBuffer [ 2048 ];
static const char* CLICK_TO_ADD_OR_EDIT = "<click to add or edit>";
CSymbolWatchModel::CSymbolWatchModel(bool editable,QObject *parent) :
@@ -16,10 +14,12 @@ CSymbolWatchModel::CSymbolWatchModel(bool editable,QObject *parent) :
m_currentSortOrder = Qt::DescendingOrder;
m_currentItemCount = 0;
m_editable = editable;
m_modelStringBuffer = new char[126];
}
CSymbolWatchModel::~CSymbolWatchModel()
{
delete [] m_modelStringBuffer;
}
Qt::ItemFlags CSymbolWatchModel::flags(const QModelIndex& index) const
@@ -56,7 +56,7 @@ QVariant CSymbolWatchModel::data(const QModelIndex& index, int role) const
if ( index.row() < m_items.count() )
{
// Get symbol's index in debug information from its segment.
symbolIdx = CCC65Interface::getSymbolIndexFromSegment(m_items.at(index.row()).symbol,m_items.at(index.row()).segment);
symbolIdx = CCC65Interface::instance()->getSymbolIndexFromSegment(m_items.at(index.row()).symbol,m_items.at(index.row()).segment);
switch ( index.column() )
{
@@ -65,12 +65,12 @@ QVariant CSymbolWatchModel::data(const QModelIndex& index, int role) const
break;
case SymbolWatchCol_Address:
// Get symbol's information based on its name and index.
addr = CCC65Interface::getSymbolAddress(m_items.at(index.row()).symbol,symbolIdx);
absAddr = CCC65Interface::getSymbolAbsoluteAddress(m_items.at(index.row()).symbol,symbolIdx);
addr = CCC65Interface::instance()->getSymbolAddress(m_items.at(index.row()).symbol,symbolIdx);
absAddr = CCC65Interface::instance()->getSymbolPhysicalAddress(m_items.at(index.row()).symbol,symbolIdx);
if ( addr != -1 )
{
nesGetPrintableAddressWithAbsolute(modelStringBuffer,addr,absAddr);
return QVariant(modelStringBuffer);
nesGetPrintablePhysicalAddress(m_modelStringBuffer,addr,absAddr);
return QVariant(m_modelStringBuffer);
}
else
{
@@ -78,7 +78,7 @@ QVariant CSymbolWatchModel::data(const QModelIndex& index, int role) const
}
break;
case SymbolWatchCol_Size:
size = CCC65Interface::getSymbolSize(m_items.at(index.row()).symbol,symbolIdx);
size = CCC65Interface::instance()->getSymbolSize(m_items.at(index.row()).symbol,symbolIdx);
if ( size )
{
return QVariant(size);
@@ -89,11 +89,11 @@ QVariant CSymbolWatchModel::data(const QModelIndex& index, int role) const
}
break;
case SymbolWatchCol_Value:
addr = CCC65Interface::getSymbolAddress(m_items.at(index.row()).symbol,symbolIdx);
addr = CCC65Interface::instance()->getSymbolAddress(m_items.at(index.row()).symbol,symbolIdx);
if ( addr != -1 )
{
char* bufferPtr = modelStringBuffer;
unsigned int symbolSize = CCC65Interface::getSymbolSize(m_items.at(index.row()).symbol,symbolIdx);
char* bufferPtr = m_modelStringBuffer;
unsigned int symbolSize = CCC65Interface::instance()->getSymbolSize(m_items.at(index.row()).symbol,symbolIdx);
// If symbol size <= 10 print values as an array, seperated by commas
if ((symbolSize > 0) && (symbolSize <= 10))
@@ -122,7 +122,7 @@ QVariant CSymbolWatchModel::data(const QModelIndex& index, int role) const
{
return QVariant("?");
}
return QVariant(modelStringBuffer);
return QVariant(m_modelStringBuffer);
}
else
{
@@ -130,10 +130,10 @@ QVariant CSymbolWatchModel::data(const QModelIndex& index, int role) const
}
break;
case SymbolWatchCol_Segment:
return CCC65Interface::getSymbolSegmentName(m_items.at(index.row()).symbol,symbolIdx);
return CCC65Interface::instance()->getSymbolSegmentName(m_items.at(index.row()).symbol,symbolIdx);
break;
case SymbolWatchCol_File:
return CCC65Interface::getSourceFileFromSymbol(m_items.at(index.row()).symbol);
return CCC65Interface::instance()->getSourceFileFromSymbol(m_items.at(index.row()).symbol);
break;
}
}
@@ -195,7 +195,7 @@ bool CSymbolWatchModel::setData(const QModelIndex &index, const QVariant &value,
case SymbolWatchCol_Value:
if ( index.row() < m_items.count() )
{
addr = CCC65Interface::getSymbolAddress(m_items.at(index.row()).symbol,CCC65Interface::getSymbolIndexFromSegment(value.toString(),m_items.at(index.row()).segment));
addr = CCC65Interface::instance()->getSymbolAddress(m_items.at(index.row()).symbol,CCC65Interface::instance()->getSymbolIndexFromSegment(value.toString(),m_items.at(index.row()).segment));
if ( addr != 0xFFFFFFFF )
{
nesSetCPUMemory(addr,value.toString().toInt(&ok,16));
@@ -315,24 +315,24 @@ int CSymbolWatchModel::resolveSymbol(QString text,int addr)
int selIdx = -1;
bool ok;
count = CCC65Interface::getSymbolMatchCount(text);
count = CCC65Interface::instance()->getSymbolMatchCount(text);
if ( count > 1 )
{
for ( idx = 0; idx < count; idx++ )
{
checkAddr = CCC65Interface::getSymbolAddress(text,idx);
checkAddr = CCC65Interface::instance()->getSymbolAddress(text,idx);
if ( checkAddr == addr )
{
selIdx = idx;
break;
}
absAddr = CCC65Interface::getSymbolAbsoluteAddress(text,idx);
symbolFile = CCC65Interface::getSourceFileFromSymbol(text);
absAddr = CCC65Interface::instance()->getSymbolPhysicalAddress(text,idx);
symbolFile = CCC65Interface::instance()->getSourceFileFromSymbol(text);
symbol = text;
symbol += " @";
nesGetPrintableAddressWithAbsolute(modelStringBuffer,checkAddr,absAddr);
symbol += modelStringBuffer;
nesGetPrintablePhysicalAddress(m_modelStringBuffer,checkAddr,absAddr);
symbol += m_modelStringBuffer;
symbol += " in ";
symbol += symbolFile;
symbols.append(symbol);
@@ -356,7 +356,7 @@ int CSymbolWatchModel::resolveSymbol(QString text,int addr)
}
}
}
return CCC65Interface::getSymbolSegment(text,selIdx);
return CCC65Interface::instance()->getSymbolSegment(text,selIdx);
}
void CSymbolWatchModel::sort(int column, Qt::SortOrder order)
+6 -5
View File
@@ -48,11 +48,12 @@ public slots:
void sort(int column, Qt::SortOrder order);
private:
QList<WatchedItem> m_items;
int m_currentSortColumn;
Qt::SortOrder m_currentSortOrder;
int m_currentItemCount;
bool m_editable;
QList<WatchedItem> m_items;
int m_currentSortColumn;
Qt::SortOrder m_currentSortOrder;
int m_currentItemCount;
bool m_editable;
char *m_modelStringBuffer;
};
#endif // CSYMBOLWATCHMODEL_H
+59 -14
View File
@@ -2,30 +2,75 @@
#include "dbg_cnesppu.h"
#include "main.h"
QThread *DebuggerUpdateThread::pThread = NULL;
int DebuggerUpdateThread::resourceCount = -1;
QMutex *DebuggerUpdateThread::pMutex = NULL;
bool DebuggerUpdateThread::silenced = true;
DebuggerUpdateThread::DebuggerUpdateThread(void (*func)(),QObject */*parent*/) :
QObject(),_func(func)
DebuggerUpdateWorker::DebuggerUpdateWorker(void (*func)(),QObject */*parent*/) :
_func(func)
{
pThread = new QThread();
}
moveToThread(pThread);
DebuggerUpdateWorker::~DebuggerUpdateWorker()
{
}
pThread->start();
void DebuggerUpdateWorker::updateDebuggers()
{
if ( _func )
{
_func();
emit updateComplete();
}
}
DebuggerUpdateThread::DebuggerUpdateThread(void (*func)(),QObject */*parent*/)
{
if ( resourceCount == -1 )
{
pThread = new QThread();
pThread->start();
pMutex = new QMutex();
pMutex->lock();
resourceCount = 1;
pMutex->unlock();
}
else
{
pMutex->lock();
resourceCount++;
pMutex->unlock();
}
pWorker = new DebuggerUpdateWorker(func);
QObject::connect(pWorker,SIGNAL(updateComplete()),this,SIGNAL(updateComplete()));
pWorker->moveToThread(pThread);
}
DebuggerUpdateThread::~DebuggerUpdateThread()
{
_func = NULL;
pThread->exit(0);
pThread->wait();
delete pThread;
delete pWorker;
pWorker = NULL;
pMutex->lock();
resourceCount--;
if ( resourceCount == 0 )
{
resourceCount = -1;
pThread->exit(0);
pThread->wait();
delete pThread;
}
pMutex->unlock();
}
void DebuggerUpdateThread::updateDebuggers()
{
if ( _func )
_func();
emit updateComplete();
if ( !silenced )
{
pWorker->updateDebuggers();
}
}
+29 -5
View File
@@ -2,6 +2,24 @@
#define DEBUGGERUPDATETHREAD_H
#include <QThread>
#include <QMutex>
class DebuggerUpdateWorker : public QObject
{
Q_OBJECT
public:
explicit DebuggerUpdateWorker(void (*func)(),QObject *parent = 0);
~DebuggerUpdateWorker();
void changeFunction(void (*func)()) { _func = func; }
void updateDebuggers();
signals:
void updateComplete();
private:
void (*_func)();
};
class DebuggerUpdateThread : public QObject
{
@@ -10,17 +28,23 @@ public:
explicit DebuggerUpdateThread(void (*func)(),QObject *parent = 0);
~DebuggerUpdateThread();
void changeFunction(void (*func)()) { _func = func; }
void changeFunction(void (*func)()) { pWorker->changeFunction(func); }
signals:
void updateComplete();
static void silence(bool silence) { silenced = silence; }
static bool isSilenced() { return silenced; }
public slots:
void updateDebuggers();
signals:
void updateComplete();
private:
void (*_func)();
QThread* pThread;
DebuggerUpdateWorker *pWorker;
static QThread *pThread;
static QMutex *pMutex;
static int resourceCount;
static bool silenced;
};
#endif // DEBUGGERUPDATETHREAD_H
@@ -1,10 +1,12 @@
#include <QMenu>
#include <QContextMenuEvent>
#include "executioninspectordockwidget.h"
#include "ui_executioninspectordockwidget.h"
#include "dbg_cnes.h"
#include "cobjectregistry.h"
#include "main.h"
ExecutionInspectorDockWidget::ExecutionInspectorDockWidget(QWidget *parent) :
CDebuggerBase(parent),
@@ -17,6 +19,16 @@ ExecutionInspectorDockWidget::ExecutionInspectorDockWidget(QWidget *parent) :
ui->showCPU->setChecked(true);
ui->showPPU->setChecked(true);
ui->tableView->setModel(model);
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
ui->tableView->setFont(QFont("Monaco", 11));
#endif
#ifdef Q_OS_LINUX
ui->tableView->setFont(QFont("Monospace", 10));
#endif
#ifdef Q_OS_WIN
ui->tableView->setFont(QFont("Consolas", 11));
#endif
}
ExecutionInspectorDockWidget::~ExecutionInspectorDockWidget()
@@ -25,24 +37,25 @@ ExecutionInspectorDockWidget::~ExecutionInspectorDockWidget()
delete model;
}
void ExecutionInspectorDockWidget::updateTargetMachine(QString /*target*/)
void ExecutionInspectorDockWidget::updateTargetMachine(QString target)
{
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), this, SLOT(updateTracer()) );
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), model, SLOT(update()) );
if ( emulator )
if ( target.compare("none") )
{
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), this, SLOT(updateTracer()) );
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), model, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(machineReady()), model, SLOT(update()));
QObject::connect ( emulator, SIGNAL(emulatorReset()), model, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), this, SLOT(updateTracer()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), model, SLOT(update()) );
}
}
void ExecutionInspectorDockWidget::showEvent(QShowEvent* /*e*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
@@ -54,7 +67,7 @@ void ExecutionInspectorDockWidget::showEvent(QShowEvent* /*e*/)
void ExecutionInspectorDockWidget::hideEvent(QHideEvent* /*e*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
@@ -99,7 +112,6 @@ void ExecutionInspectorDockWidget::updateTracer ()
{
// Update display...
show();
ui->tableView->resizeColumnsToContents();
ui->tableView->setCurrentIndex(model->index(0,0));
}
else if ( (pBreakpoint->type == eBreakOnPPUFetch) &&
@@ -107,22 +119,24 @@ void ExecutionInspectorDockWidget::updateTracer ()
{
// Update display...
show();
ui->tableView->resizeColumnsToContents();
ui->tableView->setCurrentIndex(model->index(0,0));
}
}
ui->tableView->resizeColumnsToContents();
}
void ExecutionInspectorDockWidget::on_showCPU_toggled(bool checked)
{
model->showCPU ( checked );
model->update();
ui->tableView->resizeColumnsToContents();
}
void ExecutionInspectorDockWidget::on_showPPU_toggled(bool checked)
{
model->showPPU ( checked );
model->update();
ui->tableView->resizeColumnsToContents();
}
void ExecutionInspectorDockWidget::on_actionBreak_on_CPU_execution_here_triggered()
@@ -1,14 +1,16 @@
#include <QMessageBox>
#include <QMenu>
#include <QContextMenuEvent>
#include "memoryinspectordockwidget.h"
#include "ui_memoryinspectordockwidget.h"
#include "cobjectregistry.h"
#include "main.h"
#include "environmentsettingsdialog.h"
#include "nes_emulator_core.h"
#include "c64_emulator_core.h"
#include <QMessageBox>
MemoryInspectorDockWidget::MemoryInspectorDockWidget(memDBFunc memDB,CBreakpointInfo* pBreakpoints,QWidget *parent) :
CDebuggerBase(parent),
ui(new Ui::MemoryInspectorDockWidget)
@@ -22,7 +24,39 @@ MemoryInspectorDockWidget::MemoryInspectorDockWidget(memDBFunc memDB,CBreakpoint
ui->tableView->setModel(model);
ui->tableView->setItemDelegate(delegate);
m_memDB = memDB;
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
ui->tableView->setFont(QFont("Monaco", 11));
#endif
#ifdef Q_OS_LINUX
ui->tableView->setFont(QFont("Monospace", 10));
#endif
#ifdef Q_OS_WIN
ui->tableView->setFont(QFont("Consolas", 11));
#endif
ui->tableView->resizeRowsToContents();
m_memDBFunc = memDB;
m_memDB = memDB();
m_editor = new QHexEdit();
m_editor->setAddressAreaBackgroundColor(EnvironmentSettingsDialog::marginBackgroundColor());
m_editor->setAddressAreaForegroundColor(EnvironmentSettingsDialog::marginForegroundColor());
m_editor->setHexCaps(true);
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
m_editor->setFont(QFont("Monaco", 11));
#endif
#ifdef Q_OS_LINUX
m_editor->setFont(QFont("Monospace", 10));
#endif
#ifdef Q_OS_WIN
m_editor->setFont(QFont("Consolas", 11));
#endif
m_editor->setAddressOffset(m_memDB->GetBase());
//ui->gridLayout->addWidget(m_editor);
}
MemoryInspectorDockWidget::~MemoryInspectorDockWidget()
@@ -32,27 +66,31 @@ MemoryInspectorDockWidget::~MemoryInspectorDockWidget()
delete delegate;
}
void MemoryInspectorDockWidget::updateTargetMachine(QString /*target*/)
void MemoryInspectorDockWidget::updateTargetMachine(QString target)
{
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), this, SLOT(updateMemory()) );
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), model, SLOT(update()) );
if ( emulator )
if ( target.compare("none") )
{
QObject::connect ( emulator, SIGNAL(machineReady()), model, SLOT(update()));
QObject::connect ( emulator, SIGNAL(emulatorReset()), model, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), model, SLOT(update()) );
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), this, SLOT(updateMemory()) );
QObject::connect ( emulator, SIGNAL(machineReady()), this, SLOT(updateMemory()));
QObject::connect ( emulator, SIGNAL(emulatorReset()), this, SLOT(updateMemory()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), this, SLOT(updateMemory()) );
}
}
void MemoryInspectorDockWidget::showEvent(QShowEvent* /*e*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), model, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(machineReady()), model, SLOT(update()));
QObject::connect ( emulator, SIGNAL(emulatorReset()), model, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), model, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(updateDebuggers()), model, SLOT(update()));
}
model->update();
@@ -61,10 +99,15 @@ void MemoryInspectorDockWidget::showEvent(QShowEvent* /*e*/)
void MemoryInspectorDockWidget::hideEvent(QHideEvent* /*e*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
QObject::disconnect ( breakpointWatcher, SIGNAL(breakpointHit()), model, SLOT(update()) );
QObject::disconnect ( emulator, SIGNAL(machineReady()), model, SLOT(update()));
QObject::disconnect ( emulator, SIGNAL(emulatorReset()), model, SLOT(update()) );
QObject::disconnect ( emulator, SIGNAL(emulatorPaused(bool)), model, SLOT(update()) );
QObject::disconnect ( emulator, SIGNAL(updateDebuggers()), model, SLOT(update()));
}
}
@@ -104,6 +147,18 @@ void MemoryInspectorDockWidget::updateMemory ()
int low = 0, high = 0;
int itemActual;
m_memDB = m_memDBFunc();
// m_snapshot.clear();
// for ( idx = 0; idx < m_memDB->GetSize(); idx++ )
// {
// m_snapshot += m_memDB->Get(idx);
// }
// qint64 cp = m_editor->cursorPosition();
// m_editor->setData(m_snapshot);
// m_editor->setCursorPosition(cp);
// m_editor->ensureVisible();
// Check breakpoints for hits and highlight if necessary...
for ( idx = 0; idx < m_pBreakpoints->GetNumBreakpoints(); idx++ )
{
@@ -133,7 +188,8 @@ void MemoryInspectorDockWidget::updateMemory ()
((pBreakpoint->target == eBreakInPPU) &&
((memoryType == eMemory_PPU) ||
(memoryType == eMemory_PPUpalette) ||
(memoryType == eMemory_cartCHRMEM))) )
(memoryType == eMemory_cartCHRMEM) ||
(memoryType == eMemory_cartVRAM))) )
{
// Change memory address into row/column of display...
itemActual = pBreakpoint->itemActual - model->memoryBottom();
@@ -156,7 +212,7 @@ void MemoryInspectorDockWidget::on_actionBreak_on_CPU_access_here_triggered()
QModelIndex index = ui->tableView->currentIndex();
int row = index.row();
int col = index.column();
int addr = m_memDB()->GetBase()+(row*m_memDB()->GetNumColumns())+col;
int addr = m_memDB->GetBase()+(row*m_memDB->GetNumColumns())+col;
int bpIdx;
bpIdx = m_pBreakpoints->AddBreakpoint ( eBreakOnCPUMemoryAccess,
@@ -186,7 +242,7 @@ void MemoryInspectorDockWidget::on_actionBreak_on_CPU_read_here_triggered()
QModelIndex index = ui->tableView->currentIndex();
int row = index.row();
int col = index.column();
int addr = m_memDB()->GetBase()+(row*m_memDB()->GetNumColumns())+col;
int addr = m_memDB->GetBase()+(row*m_memDB->GetNumColumns())+col;
int bpIdx;
bpIdx = m_pBreakpoints->AddBreakpoint ( eBreakOnCPUMemoryRead,
@@ -216,7 +272,7 @@ void MemoryInspectorDockWidget::on_actionBreak_on_CPU_write_here_triggered()
QModelIndex index = ui->tableView->currentIndex();
int row = index.row();
int col = index.column();
int addr = m_memDB()->GetBase()+(row*m_memDB()->GetNumColumns())+col;
int addr = m_memDB->GetBase()+(row*m_memDB->GetNumColumns())+col;
int bpIdx;
bpIdx = m_pBreakpoints->AddBreakpoint ( eBreakOnCPUMemoryWrite,
@@ -294,3 +350,10 @@ void MemoryInspectorDockWidget::snapToHandler(QString item)
}
}
}
void MemoryInspectorDockWidget::applyEnvironmentSettings()
{
m_editor->setAddressAreaBackgroundColor(EnvironmentSettingsDialog::marginBackgroundColor());
m_editor->setAddressAreaForegroundColor(EnvironmentSettingsDialog::marginForegroundColor());
m_editor->update();
}
@@ -9,6 +9,8 @@
#include "cbreakpointinfo.h"
#include "qhexedit.h"
namespace Ui {
class MemoryInspectorDockWidget;
}
@@ -31,6 +33,7 @@ public slots:
void updateMemory();
void updateTargetMachine(QString target);
void snapToHandler(QString item);
void applyEnvironmentSettings();
signals:
void breakpointsChanged();
@@ -40,7 +43,10 @@ private:
CDebuggerMemoryDisplayModel* model;
CDebuggerNumericItemDelegate* delegate;
CBreakpointInfo* m_pBreakpoints;
memDBFunc m_memDB;
memDBFunc m_memDBFunc;
CMemoryDatabase* m_memDB;
QHexEdit *m_editor;
QByteArray m_snapshot;
private slots:
void on_actionBreak_on_CPU_write_here_triggered();
@@ -6,7 +6,6 @@
#include "dbg_cnesmappers.h"
#include "cobjectregistry.h"
#include "main.h"
RegisterInspectorDockWidget::RegisterInspectorDockWidget(regDBFunc regDB,CBreakpointInfo* pBreakpoints,QWidget *parent) :
CDebuggerBase(parent),
@@ -22,12 +21,26 @@ RegisterInspectorDockWidget::RegisterInspectorDockWidget(regDBFunc regDB,CBreakp
ui->bitfieldView->setModel(bitfieldModel);
ui->bitfieldView->setItemDelegate(bitfieldDelegate);
m_regDB = regDB;
m_regDBFunc = regDB;
m_regDB = regDB();
m_register = 0;
m_pBreakpoints = pBreakpoints;
ui->label->setText ( "" );
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
ui->binaryView->setFont(QFont("Monaco", 11));
ui->bitfieldView->setFont(QFont("Monaco", 11));
#endif
#ifdef Q_OS_LINUX
ui->binaryView->setFont(QFont("Monospace", 10));
ui->bitfieldView->setFont(QFont("Monospace", 10));
#endif
#ifdef Q_OS_WIN
ui->binaryView->setFont(QFont("Monospace", 10));
ui->bitfieldView->setFont(QFont("Monospace", 10));
#endif
// Connect inter-model signals so the models can update each other.
QObject::connect ( bitfieldModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), binaryModel, SLOT(update()) );
QObject::connect ( binaryModel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), bitfieldModel, SLOT(update()) );
@@ -43,33 +56,35 @@ RegisterInspectorDockWidget::~RegisterInspectorDockWidget()
delete bitfieldDelegate;
}
void RegisterInspectorDockWidget::updateTargetMachine(QString /*target*/)
void RegisterInspectorDockWidget::updateTargetMachine(QString target)
{
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::getObject("Emulator");
if ( target.compare("none") )
{
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), this, SLOT(updateMemory()) );
QObject::connect ( emulator, SIGNAL(machineReady()), this, SLOT(updateMemory()));
QObject::connect ( emulator, SIGNAL(emulatorReset()), this, SLOT(updateMemory()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), this, SLOT(updateMemory()) );
}
}
void RegisterInspectorDockWidget::showEvent(QShowEvent* /*e*/)
{
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), this, SLOT(updateMemory()) );
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), binaryModel, SLOT(update()) );
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), bitfieldModel, SLOT(update()) );
if ( emulator )
{
QObject::connect ( emulator, SIGNAL(machineReady()), this, SLOT(updateMemory()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), this, SLOT(updateMemory()) );
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), binaryModel, SLOT(update()) );
QObject::connect ( breakpointWatcher, SIGNAL(breakpointHit()), bitfieldModel, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(machineReady()), binaryModel, SLOT(update()));
QObject::connect ( emulator, SIGNAL(emulatorReset()), binaryModel, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), binaryModel, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(machineReady()), bitfieldModel, SLOT(update()));
QObject::connect ( emulator, SIGNAL(emulatorReset()), bitfieldModel, SLOT(update()) );
QObject::connect ( emulator, SIGNAL(emulatorPaused(bool)), bitfieldModel, SLOT(update()) );
}
}
void RegisterInspectorDockWidget::showEvent(QShowEvent* /*e*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
if ( emulator )
{
QObject::connect ( emulator, SIGNAL(updateDebuggers()), binaryModel, SLOT(update()));
QObject::connect ( emulator, SIGNAL(updateDebuggers()), bitfieldModel, SLOT(update()));
}
@@ -79,10 +94,19 @@ void RegisterInspectorDockWidget::showEvent(QShowEvent* /*e*/)
void RegisterInspectorDockWidget::hideEvent(QHideEvent* /*e*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
QObject::disconnect ( breakpointWatcher, SIGNAL(breakpointHit()), binaryModel, SLOT(update()) );
QObject::disconnect ( breakpointWatcher, SIGNAL(breakpointHit()), bitfieldModel, SLOT(update()) );
QObject::disconnect ( emulator, SIGNAL(machineReady()), binaryModel, SLOT(update()));
QObject::disconnect ( emulator, SIGNAL(emulatorReset()), binaryModel, SLOT(update()) );
QObject::disconnect ( emulator, SIGNAL(emulatorPaused(bool)), binaryModel, SLOT(update()) );
QObject::disconnect ( emulator, SIGNAL(machineReady()), bitfieldModel, SLOT(update()));
QObject::disconnect ( emulator, SIGNAL(emulatorReset()), bitfieldModel, SLOT(update()) );
QObject::disconnect ( emulator, SIGNAL(emulatorPaused(bool)), bitfieldModel, SLOT(update()) );
QObject::disconnect ( emulator, SIGNAL(updateDebuggers()), binaryModel, SLOT(update()));
QObject::disconnect ( emulator, SIGNAL(updateDebuggers()), bitfieldModel, SLOT(update()));
}
@@ -115,15 +139,17 @@ void RegisterInspectorDockWidget::updateMemory ()
int itemActual;
char buffer [ 128 ];
m_regDB = m_regDBFunc();
ui->binaryView->resizeColumnsToContents();
if ( m_regDB() )
if ( m_regDB )
{
sprintf ( buffer, "%04X: %s", m_regDB()->GetRegister(m_register)->GetAddr(), m_regDB()->GetRegister(m_register)->GetName() );
sprintf ( buffer, "%04X: %s", m_regDB->GetRegister(m_register)->GetAddr(), m_regDB->GetRegister(m_register)->GetName() );
ui->label->setText ( buffer );
}
if ( m_regDB == nesGetCartridgeRegisterDatabase )
if ( m_regDBFunc == nesGetCartridgeRegisterDatabase )
{
sprintf ( buffer, "Mapper %d: %s Register Inspector", nesGetMapper(), mapperNameFromID(nesGetMapper()) );
setWindowTitle ( buffer );
@@ -193,9 +219,9 @@ void RegisterInspectorDockWidget::updateMemory ()
(pBreakpoint->type == eBreakOnCPUMemoryWrite) )
{
// Change register into row/column of display...
if ( m_regDB() )
if ( m_regDB )
{
reg = m_regDB()->GetRegisterAt(pBreakpoint->itemActual);
reg = m_regDB->GetRegisterAt(pBreakpoint->itemActual);
if ( reg >= 0 )
{
row = reg/binaryModel->columnCount();
@@ -225,9 +251,9 @@ void RegisterInspectorDockWidget::binaryView_currentChanged(QModelIndex index, Q
int cols = index.model()->columnCount();
m_register = (index.row()*cols)+index.column();
if ( m_regDB() )
if ( m_regDB )
{
sprintf ( buffer, "%04X: %s", m_regDB()->GetRegister(m_register)->GetAddr(), m_regDB()->GetRegister(m_register)->GetName() );
sprintf ( buffer, "%04X: %s", m_regDB->GetRegister(m_register)->GetAddr(), m_regDB->GetRegister(m_register)->GetName() );
ui->label->setText ( buffer );
}
@@ -241,9 +267,9 @@ void RegisterInspectorDockWidget::on_binaryView_clicked(QModelIndex index)
int cols = index.model()->columnCount();
m_register = (index.row()*cols)+index.column();
if ( m_regDB() )
if ( m_regDB )
{
sprintf ( buffer, "%04X: %s", m_regDB()->GetRegister(m_register)->GetAddr(), m_regDB()->GetRegister(m_register)->GetName() );
sprintf ( buffer, "%04X: %s", m_regDB->GetRegister(m_register)->GetAddr(), m_regDB->GetRegister(m_register)->GetName() );
ui->label->setText ( buffer );
}
@@ -257,9 +283,9 @@ void RegisterInspectorDockWidget::on_binaryView_doubleClicked(QModelIndex index)
int cols = index.model()->columnCount();
m_register = (index.row()*cols)+index.column();
if ( m_regDB() )
if ( m_regDB )
{
sprintf ( buffer, "%04X: %s", m_regDB()->GetRegister(m_register)->GetAddr(), m_regDB()->GetRegister(m_register)->GetName() );
sprintf ( buffer, "%04X: %s", m_regDB->GetRegister(m_register)->GetAddr(), m_regDB->GetRegister(m_register)->GetName() );
ui->label->setText ( buffer );
}
@@ -273,9 +299,9 @@ void RegisterInspectorDockWidget::on_binaryView_pressed(QModelIndex index)
int cols = index.model()->columnCount();
m_register = (index.row()*cols)+index.column();
if ( m_regDB() )
if ( m_regDB )
{
sprintf ( buffer, "%04X: %s", m_regDB()->GetRegister(m_register)->GetAddr(), m_regDB()->GetRegister(m_register)->GetName() );
sprintf ( buffer, "%04X: %s", m_regDB->GetRegister(m_register)->GetAddr(), m_regDB->GetRegister(m_register)->GetName() );
ui->label->setText ( buffer );
}
@@ -289,9 +315,9 @@ void RegisterInspectorDockWidget::on_binaryView_activated(QModelIndex index)
int cols = index.model()->columnCount();
m_register = (index.row()*cols)+index.column();
if ( m_regDB() )
if ( m_regDB )
{
sprintf ( buffer, "%04X: %s", m_regDB()->GetRegister(m_register)->GetAddr(), m_regDB()->GetRegister(m_register)->GetName() );
sprintf ( buffer, "%04X: %s", m_regDB->GetRegister(m_register)->GetAddr(), m_regDB->GetRegister(m_register)->GetName() );
ui->label->setText ( buffer );
}
@@ -305,9 +331,9 @@ void RegisterInspectorDockWidget::on_binaryView_entered(QModelIndex index)
int cols = index.model()->columnCount();
m_register = (index.row()*cols)+index.column();
if ( m_regDB() )
if ( m_regDB )
{
sprintf ( buffer, "%04X: %s", m_regDB()->GetRegister(m_register)->GetAddr(), m_regDB()->GetRegister(m_register)->GetName() );
sprintf ( buffer, "%04X: %s", m_regDB->GetRegister(m_register)->GetAddr(), m_regDB->GetRegister(m_register)->GetName() );
ui->label->setText ( buffer );
}
@@ -317,12 +343,18 @@ void RegisterInspectorDockWidget::on_binaryView_entered(QModelIndex index)
void RegisterInspectorDockWidget::on_bitfieldView_clicked(QModelIndex index)
{
bitfieldDelegate->setBitfield ( m_regDB()->GetRegister(m_register)->GetBitfield(index.row()) );
binaryModel->update();
if ( m_regDB )
{
bitfieldDelegate->setBitfield ( m_regDB->GetRegister(m_register)->GetBitfield(index.row()) );
binaryModel->update();
}
}
void RegisterInspectorDockWidget::on_bitfieldView_doubleClicked(QModelIndex index)
{
bitfieldDelegate->setBitfield ( m_regDB()->GetRegister(m_register)->GetBitfield(index.row()) );
binaryModel->update();
if ( m_regDB )
{
bitfieldDelegate->setBitfield ( m_regDB->GetRegister(m_register)->GetBitfield(index.row()) );
binaryModel->update();
}
}
@@ -38,7 +38,8 @@ private:
CDebuggerBitfieldComboBoxDelegate* bitfieldDelegate;
CDebuggerNumericItemDelegate* binaryDelegate;
CBreakpointInfo* m_pBreakpoints;
regDBFunc m_regDB;
regDBFunc m_regDBFunc;
CRegisterDatabase* m_regDB;
int m_register;
private slots:
+50 -18
View File
@@ -1,8 +1,15 @@
#include <QMessageBox>
#include <QMenu>
#include <QKeyEvent>
#include <QDragEnterEvent>
#include <QDragMoveEvent>
#include <QDropEvent>
#include <QContextMenuEvent>
#include "symbolwatchdockwidget.h"
#include "ui_symbolwatchdockwidget.h"
#include "cobjectregistry.h"
#include "main.h"
#include "ccc65interface.h"
@@ -35,6 +42,19 @@ SymbolWatchDockWidget::SymbolWatchDockWidget(QWidget *parent) :
ram->setItemDelegateForColumn(SymbolWatchCol_Value,ramValueDelegate);
ram->resizeColumnsToContents();
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
watch->setFont(QFont("Monaco", 11));
ram->setFont(QFont("Monaco", 11));
#endif
#ifdef Q_OS_LINUX
watch->setFont(QFont("Monospace", 10));
ram->setFont(QFont("Monospace", 10));
#endif
#ifdef Q_OS_WIN
watch->setFont(QFont("Consolas", 11));
ram->setFont(QFont("Consolas", 11));
#endif
QObject::connect(watch->horizontalHeader(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),watchModel,SLOT(sort(int,Qt::SortOrder)));
QObject::connect(watchModel,SIGNAL(rowsInserted(QModelIndex,int,int)),this,SLOT(updateUi()));
QObject::connect(ram->horizontalHeader(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),ramModel,SLOT(sort(int,Qt::SortOrder)));
@@ -58,8 +78,8 @@ void SymbolWatchDockWidget::createNesUi()
return;
}
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
sramTab = new QWidget();
sramTab->setObjectName(QString::fromUtf8("sramTab"));
@@ -128,6 +148,19 @@ void SymbolWatchDockWidget::createNesUi()
exram->setItemDelegateForColumn(SymbolWatchCol_Value,exramValueDelegate);
exram->resizeColumnsToContents();
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
sram->setFont(QFont("Monaco", 11));
exram->setFont(QFont("Monaco", 11));
#endif
#ifdef Q_OS_LINUX
sram->setFont(QFont("Monospace", 10));
exram->setFont(QFont("Monospace", 10));
#endif
#ifdef Q_OS_WIN
sram->setFont(QFont("Consolas", 11));
exram->setFont(QFont("Consolas", 11));
#endif
QObject::connect(sram->horizontalHeader(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),sramModel,SLOT(sort(int,Qt::SortOrder)));
QObject::connect(exram->horizontalHeader(),SIGNAL(sortIndicatorChanged(int,Qt::SortOrder)),exramModel,SLOT(sort(int,Qt::SortOrder)));
@@ -184,9 +217,9 @@ void SymbolWatchDockWidget::destroyC64Ui()
void SymbolWatchDockWidget::updateTargetMachine(QString target)
{
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* compiler = CObjectRegistry::getObject("Compiler");
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject* compiler = CObjectRegistry::instance()->getObject("Compiler");
if ( !target.compare("nes",Qt::CaseInsensitive) )
{
@@ -205,11 +238,11 @@ void SymbolWatchDockWidget::updateTargetMachine(QString target)
createC64Ui();
}
QObject::connect(compiler,SIGNAL(compileDone(bool)),this,SLOT(updateVariables()));
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),watchModel,SLOT(update()));
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),ramModel,SLOT(update()));
if ( emulator )
if ( target.compare("none") )
{
QObject::connect(compiler,SIGNAL(compileDone(bool)),this,SLOT(updateVariables()));
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),watchModel,SLOT(update()));
QObject::connect(breakpointWatcher,SIGNAL(breakpointHit()),ramModel,SLOT(update()));
QObject::connect(emulator,SIGNAL(machineReady()),watchModel,SLOT(update()));
QObject::connect(emulator,SIGNAL(emulatorReset()),watchModel,SLOT(update()));
QObject::connect(emulator,SIGNAL(emulatorPaused(bool)),watchModel,SLOT(update()));
@@ -218,7 +251,6 @@ void SymbolWatchDockWidget::updateTargetMachine(QString target)
QObject::connect(emulator,SIGNAL(emulatorPaused(bool)),ramModel,SLOT(update()));
QObject::connect(emulator,SIGNAL(machineReady()),this,SLOT(updateVariables()));
}
}
void SymbolWatchDockWidget::updateUi()
@@ -228,7 +260,7 @@ void SymbolWatchDockWidget::updateUi()
void SymbolWatchDockWidget::updateVariables()
{
QStringList symbols = CCC65Interface::getSymbolsForSourceFile("");
QStringList symbols = CCC65Interface::instance()->getSymbolsForSourceFile("");
int addr;
if ( !m_targetLoaded.compare("nes",Qt::CaseInsensitive) )
@@ -238,7 +270,7 @@ void SymbolWatchDockWidget::updateVariables()
exramModel->removeRows(0,exramModel->rowCount());
foreach ( QString symbol,symbols )
{
addr = CCC65Interface::getSymbolAddress(symbol);
addr = CCC65Interface::instance()->getSymbolAddress(symbol);
if ( addr < MEM_2KB )
{
// Symbol is in RAM...
@@ -264,7 +296,7 @@ void SymbolWatchDockWidget::updateVariables()
ramModel->removeRows(0,ramModel->rowCount());
foreach ( QString symbol,symbols )
{
addr = CCC65Interface::getSymbolAddress(symbol);
addr = CCC65Interface::instance()->getSymbolAddress(symbol);
// Symbol is in RAM...
ramModel->insertRow(symbol,addr);
@@ -380,7 +412,7 @@ void SymbolWatchDockWidget::contextMenuEvent(QContextMenuEvent *event)
void SymbolWatchDockWidget::showEvent(QShowEvent*)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
@@ -415,7 +447,7 @@ void SymbolWatchDockWidget::showEvent(QShowEvent*)
void SymbolWatchDockWidget::hideEvent(QHideEvent */*event*/)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
@@ -717,7 +749,7 @@ void SymbolWatchDockWidget::on_actionGo_to_Definition_triggered()
}
symbol = index.data(Qt::DisplayRole).toString();
file = CCC65Interface::getSourceFileFromSymbol(symbol);
file = CCC65Interface::instance()->getSourceFileFromSymbol(symbol);
emit snapTo("SourceNavigatorFile,"+file);
emit snapTo("SourceNavigatorSymbol,"+symbol);
@@ -761,7 +793,7 @@ void SymbolWatchDockWidget::exram_doubleClicked(const QModelIndex &index)
void SymbolWatchDockWidget::on_tabWidget_currentChanged(int index)
{
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
if ( emulator )
{
+2 -2
View File
@@ -6,8 +6,8 @@
CDesignerEditorBase::CDesignerEditorBase(IProjectTreeViewItem* link,QWidget *parent) :
QMainWindow(parent)
{
QWidget* searchBar = CDockWidgetRegistry::getWidget("Search Bar");
QWidget* search = CDockWidgetRegistry::getWidget("Search");
QWidget* searchBar = CDockWidgetRegistry::instance()->getWidget("Search Bar");
QWidget* search = CDockWidgetRegistry::instance()->getWidget("Search");
InitTabItem(link);
+2
View File
@@ -35,6 +35,8 @@ public slots:
virtual void applyEnvironmentSettingsToTab() {}
virtual void applyAppSettingsToTab() {}
virtual void checkOpenFile(QDateTime /*lastActivationTime*/) {}
virtual void itemAdded(QUuid /*uuid*/) {}
virtual void itemRemoved(QUuid /*uuid*/) {}
signals:
void editor_modified(bool m);
+170 -118
View File
@@ -5,11 +5,13 @@
#include <QMenu>
#include <QAction>
#include <QPixmap>
#include <QStringList>
#include <QSettings>
#include <QDir>
#include "Qsci/qsciscintillabase.h"
#include "cobjectregistry.h"
#include "main.h"
#include "ccc65interface.h"
@@ -20,6 +22,14 @@
#include "cbreakpointinfo.h"
#include "cmarker.h"
#include "cnesicideproject.h"
#include "csourceitem.h"
#include "nes_emulator_core.h"
#include "c64_emulator_core.h"
#include "environmentsettingsdialog.h"
static char toolTipText [ 2048 ];
static char annotationBuffer [ 2048 ];
static char resolutionBuffer [ 2048 ];
@@ -31,10 +41,10 @@ CodeEditorForm::CodeEditorForm(QString fileName,QString sourceCode,IProjectTreeV
m_scintilla(NULL),
m_apis(NULL)
{
QDockWidget* codeBrowser = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Assembly Browser"));
QDockWidget* breakpoints = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Breakpoints"));
QDockWidget* symbolWatch = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Symbol Inspector"));
QDockWidget* executionVisualizer = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::getWidget("Execution Visualizer"));
QDockWidget* codeBrowser = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Assembly Browser"));
QDockWidget* breakpoints = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Breakpoints"));
QDockWidget* symbolWatch = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Symbol Inspector"));
QDockWidget* executionVisualizer = dynamic_cast<QDockWidget*>(CDockWidgetRegistry::instance()->getWidget("Execution Visualizer"));
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE");
CMarker* markers = nesGetExecutionMarkerDatabase();
MarkerSetInfo* pMarker;
@@ -70,7 +80,7 @@ CodeEditorForm::CodeEditorForm(QString fileName,QString sourceCode,IProjectTreeV
m_scintilla->setAutoCompletionThreshold(2);
m_scintilla->setAutoCompletionCaseSensitivity(false);
m_scintilla->setAutoCompletionReplaceWord(false);
m_scintilla->setAutoCompletionUseSingle(QsciScintilla::AcusAlways);
m_scintilla->setAutoCompletionUseSingle(QsciScintilla::AcusNever);
m_scintilla->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
m_scintilla->setMarginWidth(4,0);
@@ -128,14 +138,14 @@ CodeEditorForm::CodeEditorForm(QString fileName,QString sourceCode,IProjectTreeV
QObject::connect ( this, SIGNAL(breakpointsChanged()), breakpoints, SIGNAL(breakpointsChanged()) );
QObject::connect ( breakpoints, SIGNAL(breakpointsChanged()), this, SLOT(external_breakpointsChanged()) );
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
QObject::connect ( executionVisualizer, SIGNAL(breakpointsChanged()), this, SLOT(external_breakpointsChanged()) );
}
QObject* breakpointWatcher = CObjectRegistry::getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::getObject("Emulator");
QObject* compiler = CObjectRegistry::getObject("Compiler");
QObject* breakpointWatcher = CObjectRegistry::instance()->getObject("Breakpoint Watcher");
QObject* emulator = CObjectRegistry::instance()->getObject("Emulator");
QObject* compiler = CObjectRegistry::instance()->getObject("Compiler");
QObject::connect ( compiler, SIGNAL(compileStarted()), this, SLOT(compiler_compileStarted()) );
QObject::connect ( compiler, SIGNAL(compileDone(bool)), this, SLOT(compiler_compileDone(bool)) );
@@ -179,11 +189,11 @@ void CodeEditorForm::customContextMenuRequested(const QPoint &pos)
QString symbol = m_scintilla->wordAtPoint(pos);
QAction* action;
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
m_pBreakpoints = nesGetBreakpointDatabase();
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
m_pBreakpoints = c64GetBreakpointDatabase();
}
@@ -240,6 +250,7 @@ void CodeEditorForm::customContextMenuRequested(const QPoint &pos)
menu.addAction(ui->actionStart_marker_here);
menu.addAction(ui->actionEnd_marker_here);
menu.addAction(ui->actionStart_End_marker_here);
menu.addSeparator();
m_breakpointIndex = bp;
@@ -247,7 +258,7 @@ void CodeEditorForm::customContextMenuRequested(const QPoint &pos)
}
if ( (!symbol.isEmpty()) &&
(CCC65Interface::isStringASymbol(symbol)) )
(CCC65Interface::instance()->isStringASymbol(symbol)) )
{
QString str = GO_TO_DEFINITION_TEXT;
str += symbol;
@@ -262,7 +273,7 @@ void CodeEditorForm::customContextMenuRequested(const QPoint &pos)
if ( (action) && (action->text().startsWith(GO_TO_DEFINITION_TEXT)) )
{
QString file = CCC65Interface::getSourceFileFromSymbol(symbol);
QString file = CCC65Interface::instance()->getSourceFileFromSymbol(symbol);
emit snapToTab("SourceNavigatorFile,"+file);
emit snapToTab("SourceNavigatorSymbol,"+symbol);
}
@@ -398,7 +409,7 @@ void CodeEditorForm::compiler_compileDone(bool ok)
for ( line = 0; line < m_scintilla->lines(); line++ )
{
if ( CCC65Interface::isErrorOnLineOfFile(m_fileName,line+1) )
if ( CCC65Interface::instance()->isErrorOnLineOfFile(m_fileName,line+1) )
{
m_scintilla->markerAdd(line,Marker_Error);
}
@@ -427,11 +438,11 @@ void CodeEditorForm::external_breakpointsChanged()
int asmcount;
int asmline;
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
m_pBreakpoints = nesGetBreakpointDatabase();
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
m_pBreakpoints = c64GetBreakpointDatabase();
}
@@ -445,11 +456,11 @@ void CodeEditorForm::external_breakpointsChanged()
for ( line = 0; line < m_scintilla->lines(); line++ )
{
asmcount = CCC65Interface::getLineMatchCount(m_fileName,line+1);
asmcount = CCC65Interface::instance()->getLineMatchCount(m_fileName,line+1);
for ( asmline = 0; asmline < asmcount; asmline++ )
{
addr = CCC65Interface::getAddressFromFileAndLine(m_fileName,line+1,asmline);
absAddr = CCC65Interface::getAbsoluteAddressFromFileAndLine(m_fileName,line+1,asmline);
addr = CCC65Interface::instance()->getAddressFromFileAndLine(m_fileName,line+1,asmline);
absAddr = CCC65Interface::instance()->getPhysicalAddressFromFileAndLine(m_fileName,line+1,asmline);
if ( addr != (unsigned int)-1 )
{
@@ -477,14 +488,14 @@ void CodeEditorForm::external_breakpointsChanged()
if ( (pBreakpoint->enabled) &&
(pBreakpoint->type == eBreakOnCPUExecution) &&
(pBreakpoint->item1 <= addr) &&
((absAddr == (unsigned int)-1) || (absAddr == pBreakpoint->item1Absolute)) )
((absAddr == (unsigned int)-1) || (absAddr == pBreakpoint->item1Physical)) )
{
m_scintilla->markerAdd(line,Marker_Breakpoint);
}
else if ( (!pBreakpoint->enabled) &&
(pBreakpoint->type == eBreakOnCPUExecution) &&
(pBreakpoint->item1 <= addr) &&
((absAddr == (unsigned int)-1) || (absAddr == pBreakpoint->item1Absolute)) )
((absAddr == (unsigned int)-1) || (absAddr == pBreakpoint->item1Physical)) )
{
m_scintilla->markerAdd(line,Marker_BreakpointDisabled);
}
@@ -577,11 +588,11 @@ void CodeEditorForm::editor_marginClicked(int margin,int line,Qt::KeyboardModifi
int addr = 0;
int absAddr = 0;
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
m_pBreakpoints = nesGetBreakpointDatabase();
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
m_pBreakpoints = c64GetBreakpointDatabase();
}
@@ -695,45 +706,45 @@ void CodeEditorForm::updateToolTip(QString symbol)
if ( EnvironmentSettingsDialog::showSymbolTips() )
{
// Look for C-language emitted symbols [prepended with underscore]...
if ( (CCC65Interface::getSymbolType(clangSymbol) == CC65_SYM_LABEL) ||
(CCC65Interface::getSymbolType(clangSymbol) == CC65_SYM_IMPORT) )
if ( (CCC65Interface::instance()->getSymbolType(clangSymbol) == CC65_SYM_LABEL) ||
(CCC65Interface::instance()->getSymbolType(clangSymbol) == CC65_SYM_IMPORT) )
{
symbol = clangSymbol;
}
if ( (CCC65Interface::getSymbolType(symbol) == CC65_SYM_LABEL) ||
(CCC65Interface::getSymbolType(symbol) == CC65_SYM_IMPORT) )
if ( (CCC65Interface::instance()->getSymbolType(symbol) == CC65_SYM_LABEL) ||
(CCC65Interface::instance()->getSymbolType(symbol) == CC65_SYM_IMPORT) )
{
addr = CCC65Interface::getSymbolAddress(symbol);
addr = CCC65Interface::instance()->getSymbolAddress(symbol);
if ( addr != 0xFFFFFFFF )
{
absAddr = CCC65Interface::getSymbolAbsoluteAddress(symbol);
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
absAddr = CCC65Interface::instance()->getSymbolPhysicalAddress(symbol);
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
nesGetPrintableAddressWithAbsolute(address,addr,absAddr);
nesGetPrintablePhysicalAddress(address,addr,absAddr);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
c64GetPrintableAddressWithAbsolute(address,addr,absAddr);
c64GetPrintablePhysicalAddress(address,addr,absAddr);
}
file = CCC65Interface::getSourceFileFromSymbol(symbol);
line = CCC65Interface::getSourceLineFromFileAndSymbol(file,symbol);
file = CCC65Interface::instance()->getSourceFileFromSymbol(symbol);
line = CCC65Interface::instance()->getSourceLineFromFileAndSymbol(file,symbol);
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
sprintf(toolTipText,TOOLTIP_LABEL,symbol.toLatin1().constData(),file.toLatin1().constData(),line,address,nesGetMemory(addr));
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
sprintf(toolTipText,TOOLTIP_LABEL,symbol.toLatin1().constData(),file.toLatin1().constData(),line,address,c64GetMemory(addr));
}
setToolTip(toolTipText);
}
}
else if ( CCC65Interface::getSymbolType(symbol) == CC65_SYM_EQUATE )
else if ( CCC65Interface::instance()->getSymbolType(symbol) == CC65_SYM_EQUATE )
{
addr = CCC65Interface::getSymbolAddress(symbol);
addr = CCC65Interface::instance()->getSymbolAddress(symbol);
sprintf(toolTipText,TOOLTIP_EQUATE,symbol.toLatin1().constData(),addr);
setToolTip(toolTipText);
@@ -745,11 +756,11 @@ void CodeEditorForm::setBreakpoint(int line, int addr, int absAddr)
{
int bpIdx;
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
m_pBreakpoints = nesGetBreakpointDatabase();
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
m_pBreakpoints = c64GetBreakpointDatabase();
}
@@ -844,6 +855,45 @@ void CodeEditorForm::on_actionEnable_breakpoint_triggered()
}
}
void CodeEditorForm::on_actionStart_End_marker_here_triggered()
{
CMarker* markers = nesGetExecutionMarkerDatabase();
int marker = -1;
int line, lineFrom, lineTo, indexFrom, indexTo;
int addr = 0;
int absAddr = 0;
m_scintilla->getSelection(&lineFrom,&indexFrom,&lineTo,&indexTo);
if ( lineFrom != -1 )
{
resolveLineAddress(lineFrom,&addr,&absAddr);
if ( addr != -1 )
{
// Find unused Marker entry...
marker = markers->AddMarker(addr,absAddr);
emit breakpointsChanged();
emit markProjectDirty(true);
}
}
if ( lineTo != -1 )
{
if ( marker >= 0 )
{
resolveLineAddress(lineTo,&addr,&absAddr);
if ( addr != -1 )
{
markers->CompleteMarker(marker,addr,absAddr);
emit breakpointsChanged();
emit markProjectDirty(true);
}
}
}
}
void CodeEditorForm::on_actionStart_marker_here_triggered()
{
CMarker* markers = nesGetExecutionMarkerDatabase();
@@ -920,14 +970,7 @@ void CodeEditorForm::setSourceCode(QString source)
// Force EOL conversion if desired.
if ( EnvironmentSettingsDialog::eolForceConsistent() )
{
// Convert first to Unix to get rid of CR+LF.
m_scintilla->convertEols(QsciScintilla::EolUnix);
// Then if mode is not Unix, convert to it.
if ( EnvironmentSettingsDialog::eolMode() != QsciScintilla::EolUnix )
{
m_scintilla->convertEols((QsciScintilla::EolMode)EnvironmentSettingsDialog::eolMode());
}
m_scintilla->convertEols((QsciScintilla::EolMode)EnvironmentSettingsDialog::eolMode());
}
// Force repaint of error tags.
@@ -981,23 +1024,23 @@ void CodeEditorForm::resolveLineAddress(int line, int *addr, int *absAddr)
int asmline;
bool ok;
asmcount = CCC65Interface::getLineMatchCount(m_fileName,line+1);
asmcount = CCC65Interface::instance()->getLineMatchCount(m_fileName,line+1);
if ( asmcount > 1 )
{
for ( asmline = 0; asmline < asmcount; asmline++ )
{
(*addr) = CCC65Interface::getAddressFromFileAndLine(m_fileName,line+1,asmline);
(*absAddr) = CCC65Interface::getAbsoluteAddressFromFileAndLine(m_fileName,line+1,asmline);
(*addr) = CCC65Interface::instance()->getAddressFromFileAndLine(m_fileName,line+1,asmline);
(*absAddr) = CCC65Interface::instance()->getPhysicalAddressFromFileAndLine(m_fileName,line+1,asmline);
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
nesGetPrintableAddressWithAbsolute(resolutionBuffer,(*addr),(*absAddr));
nesGetDisassemblyAtAbsoluteAddress((*absAddr),resolutionBuffer);
nesGetPrintablePhysicalAddress(resolutionBuffer,(*addr),(*absAddr));
nesGetDisassemblyAtPhysicalAddress((*absAddr),resolutionBuffer);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
c64GetPrintableAddressWithAbsolute(resolutionBuffer,(*addr),(*absAddr));
c64GetDisassemblyAtAbsoluteAddress((*absAddr),resolutionBuffer);
c64GetPrintablePhysicalAddress(resolutionBuffer,(*addr),(*absAddr));
c64GetDisassemblyAtPhysicalAddress((*absAddr),resolutionBuffer);
}
asmChunk = resolutionBuffer;
asmChunk += ":";
@@ -1026,8 +1069,8 @@ void CodeEditorForm::resolveLineAddress(int line, int *addr, int *absAddr)
}
else
{
(*addr) = CCC65Interface::getAddressFromFileAndLine(m_fileName,line+1);
(*absAddr) = CCC65Interface::getAbsoluteAddressFromFileAndLine(m_fileName,line+1);
(*addr) = CCC65Interface::instance()->getAddressFromFileAndLine(m_fileName,line+1);
(*absAddr) = CCC65Interface::instance()->getPhysicalAddressFromFileAndLine(m_fileName,line+1);
}
}
@@ -1058,12 +1101,12 @@ void CodeEditorForm::annotateText()
first = true;
firstBlock = true;
asmcount = CCC65Interface::getLineMatchCount(m_fileName,line+1);
asmcount = CCC65Interface::instance()->getLineMatchCount(m_fileName,line+1);
for ( asmline = 0; asmline < asmcount; asmline++ )
{
addr = CCC65Interface::getAddressFromFileAndLine(m_fileName,line+1,asmline);
absAddr = CCC65Interface::getAbsoluteAddressFromFileAndLine(m_fileName,line+1,asmline);
endAddr = CCC65Interface::getEndAddressFromAbsoluteAddress(addr,absAddr);
addr = CCC65Interface::instance()->getAddressFromFileAndLine(m_fileName,line+1,asmline);
absAddr = CCC65Interface::instance()->getPhysicalAddressFromFileAndLine(m_fileName,line+1,asmline);
endAddr = CCC65Interface::instance()->getEndAddressFromPhysicalAddress(addr,absAddr);
if ( (addr != -1) && (absAddr != -1) && (endAddr != -1) )
{
@@ -1075,15 +1118,15 @@ void CodeEditorForm::annotateText()
for ( ; addr <= endAddr; addr++, absAddr++ )
{
if ( CCC65Interface::isAbsoluteAddressAnOpcode(absAddr) )
if ( CCC65Interface::instance()->isPhysicalAddressAnOpcode(absAddr) )
{
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
nesGetDisassemblyAtAbsoluteAddress(absAddr,disassembly);
nesGetDisassemblyAtPhysicalAddress(absAddr,disassembly);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
c64GetDisassemblyAtAbsoluteAddress(absAddr,disassembly);
c64GetDisassemblyAtPhysicalAddress(absAddr,disassembly);
}
if ( disassembly[0] )
{
@@ -1093,13 +1136,13 @@ void CodeEditorForm::annotateText()
}
first = false;
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
nesGetPrintableAddressWithAbsolute(address,addr,absAddr);
nesGetPrintablePhysicalAddress(address,addr,absAddr);
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
c64GetPrintableAddressWithAbsolute(address,addr,absAddr);
c64GetPrintablePhysicalAddress(address,addr,absAddr);
}
pAnnotationBuffer += sprintf(pAnnotationBuffer,"%s:",address);
pAnnotationBuffer += sprintf(pAnnotationBuffer,disassembly);
@@ -1227,10 +1270,10 @@ void CodeEditorForm::snapTo(QString item)
addr = splits.at(3).toInt(NULL,16);
absAddr = (splits.at(1).toInt(NULL,16)*MEM_8KB)+splits.at(2).toInt(NULL,16);
}
fileName = CCC65Interface::getSourceFileFromAbsoluteAddress(addr,absAddr);
fileName = QDir::cleanPath(CCC65Interface::instance()->getSourceFileFromPhysicalAddress(addr,absAddr));
if ( fileName == m_fileName )
{
line = CCC65Interface::getSourceLineFromAbsoluteAddress(addr,absAddr);
line = CCC65Interface::instance()->getSourceLineFromPhysicalAddress(addr,absAddr);
highlightLine(line);
}
}
@@ -1268,7 +1311,8 @@ void CodeEditorForm::snapTo(QString item)
else if ( item.startsWith("SourceNavigatorFile,") )
{
splits = item.split(QRegExp("[,]"));
if ( m_fileName.endsWith(splits.at(1),Qt::CaseInsensitive) )
QString cleanPath = QDir::cleanPath(splits.at(1));
if ( m_fileName.endsWith(cleanPath,Qt::CaseInsensitive) )
{
if ( splits.count() == 3 )
{
@@ -1287,7 +1331,8 @@ void CodeEditorForm::snapTo(QString item)
else if ( item.startsWith("OutputPaneFile,") )
{
splits = item.split(QRegExp("[,]"));
if ( splits.at(1) == m_fileName )
QString cleanPath = QDir::cleanPath(splits.at(1));
if ( cleanPath == m_fileName )
{
if ( splits.count() == 3 )
{
@@ -1307,7 +1352,7 @@ void CodeEditorForm::snapTo(QString item)
else if ( item.startsWith("SourceNavigatorSymbol,") )
{
splits = item.split(QRegExp("[,]"));
line = CCC65Interface::getSourceLineFromFileAndSymbol(m_fileName,splits.at(1));
line = CCC65Interface::instance()->getSourceLineFromFileAndSymbol(m_fileName,splits.at(1));
if ( line >= 0 )
{
highlightLine(line);
@@ -1357,7 +1402,7 @@ void CodeEditorForm::applyEnvironmentSettingsToTab()
{
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE");
int op;
if ( EnvironmentSettingsDialog::foldSource() )
{
m_scintilla->setMarginType(Margin_Folding,QsciScintilla::SymbolMargin);
@@ -1370,6 +1415,8 @@ void CodeEditorForm::applyEnvironmentSettingsToTab()
m_scintilla->setFolding(QsciScintilla::NoFoldStyle,Margin_Folding);
}
m_scintilla->setUtf8(EnvironmentSettingsDialog::textEncodingIsUtf8());
m_scintilla->setEolMode((QsciScintilla::EolMode)EnvironmentSettingsDialog::eolMode());
m_scintilla->setMarginsBackgroundColor(EnvironmentSettingsDialog::marginBackgroundColor());
@@ -1385,53 +1432,58 @@ void CodeEditorForm::applyEnvironmentSettingsToTab()
m_scintilla->setMarkerBackgroundColor(m_lexer->defaultPaper(),Marker_Highlight);
}
m_language = Language_Default;
m_scintilla->setLexer();
if ( m_lexer )
if ( m_lexer == NULL )
{
delete m_lexer;
}
m_language = Language_Default;
m_scintilla->setLexer();
foreach ( QString ext, EnvironmentSettingsDialog::highlightAsC().split(" ") )
{
if ( m_fileName.endsWith(ext,Qt::CaseInsensitive) )
{
m_language = Language_C;
}
}
if ( m_language == Language_Default )
{
foreach ( QString ext, EnvironmentSettingsDialog::highlightAsASM().split(" ") )
foreach ( QString ext, EnvironmentSettingsDialog::highlightAsC().split(" ") )
{
if ( m_fileName.endsWith(ext,Qt::CaseInsensitive) )
{
m_language = Language_Assembly;
m_language = Language_C;
}
}
}
if ( m_language == Language_C )
{
m_lexer = new QsciLexerCC65(m_scintilla);
}
else if ( m_language == Language_Assembly )
{
m_lexer = new QsciLexerCA65(m_scintilla);
if ( m_apis )
delete m_apis;
m_apis = new QsciAPIsCA65(m_lexer);
for ( op = 0; op < 256; op++ )
if ( m_language == Language_Default )
{
QString opcodeTooltipText = OPCODEINFO(op);
opcodeTooltipText = opcodeTooltipText.split(":")[0];
m_apis->add(opcodeTooltipText);
foreach ( QString ext, EnvironmentSettingsDialog::highlightAsASM().split(" ") )
{
if ( m_fileName.endsWith(ext,Qt::CaseInsensitive) )
{
m_language = Language_Assembly;
}
}
}
if ( m_language == Language_C )
{
m_lexer = new QsciLexerCC65(m_scintilla);
}
else if ( m_language == Language_Assembly )
{
m_lexer = new QsciLexerCA65(m_scintilla);
m_apis = new QsciAPIsCA65(m_lexer);
QStringList opcodes;
for ( op = 0; op < 256; op++ )
{
QString opcodeTooltipText = OPCODEINFO(op);
opcodeTooltipText = opcodeTooltipText.split(":")[0];
if ( !(opcodeTooltipText.isEmpty() || opcodes.contains(opcodeTooltipText)) )
{
opcodes += opcodeTooltipText;
}
}
foreach ( QString opcode, opcodes )
{
m_apis->add(opcode);
}
m_apis->prepare();
}
else
{
m_lexer = new QsciLexerDefault(m_scintilla);
}
m_apis->prepare();
}
else
{
m_lexer = new QsciLexerDefault(m_scintilla);
}
m_scintilla->setLexer(m_lexer);
+2 -1
View File
@@ -90,7 +90,7 @@ private:
CBreakpointInfo* m_pBreakpoints;
QsciScintilla* m_scintilla;
QsciLexer* m_lexer;
QsciAPIsCA65* m_apis;
QsciAPIs* m_apis;
int m_breakpointIndex;
int m_contextMenuLine;
int m_toolTipTimer;
@@ -126,6 +126,7 @@ public slots:
void on_actionClear_marker_triggered();
void on_actionEnd_marker_here_triggered();
void on_actionStart_marker_here_triggered();
void on_actionStart_End_marker_here_triggered();
void on_actionEnable_breakpoint_triggered();
void on_actionRemove_breakpoint_triggered();
void on_actionDisable_breakpoint_triggered();
+8
View File
@@ -86,6 +86,14 @@
<string>Clear Visualization Markers</string>
</property>
</action>
<action name="actionStart_End_marker_here">
<property name="text">
<string>Set Visualization Marker on selected region</string>
</property>
<property name="toolTip">
<string>Set Visualization Marker on selected region</string>
</property>
</action>
</widget>
<resources/>
<connections/>
@@ -3,8 +3,6 @@
#include "cpropertyenumlistmodel.h"
#include "cpropertyitem.h"
static char modelStringBuffer [ 2048 ];
static const char* CLICK_TO_ADD_OR_EDIT = "<click to add or edit>";
CPropertyEnumListModel::CPropertyEnumListModel(bool editable,QObject *parent) :
+2 -2
View File
@@ -37,8 +37,8 @@ public slots:
void update();
private:
QList<PropertyEnumItem> m_items;
bool m_editable;
QList<PropertyEnumItem> m_items;
bool m_editable;
};
#endif // CPROPERTYENUMLISTMODEL_H
@@ -2,8 +2,6 @@
#include "cpropertylistmodel.h"
static char modelStringBuffer [ 2048 ];
static const char* ADD_MESSAGE = "<add new Tile Properties in Project Properties>";
CPropertyListModel::CPropertyListModel(bool editable,QObject *parent) :
@@ -0,0 +1,30 @@
#include "filepropertiesdialog.h"
#include "ui_filepropertiesdialog.h"
FilePropertiesDialog::FilePropertiesDialog(CProjectBase *base, QWidget *parent) :
QDialog(parent),
ui(new Ui::FilePropertiesDialog)
{
ui->setupUi(this);
_base = base;
setWindowTitle(base->caption());
ui->includeInBuild->setChecked(base->includeInBuild());
}
FilePropertiesDialog::~FilePropertiesDialog()
{
delete ui;
}
void FilePropertiesDialog::on_buttonBox_accepted()
{
_base->setIncludeInBuild(ui->includeInBuild->isChecked());
accept();
}
void FilePropertiesDialog::on_buttonBox_rejected()
{
reject();
}
+33
View File
@@ -0,0 +1,33 @@
#ifndef FILEPROPERTIESDIALOG_H
#define FILEPROPERTIESDIALOG_H
#include <QDialog>
#include <QUuid>
#include "cprojectbase.h"
namespace Ui {
class FilePropertiesDialog;
}
class FilePropertiesDialog : public QDialog
{
Q_OBJECT
public:
explicit FilePropertiesDialog(CProjectBase *base, QWidget *parent = nullptr);
~FilePropertiesDialog();
protected:
CProjectBase *_base;
private slots:
void on_buttonBox_accepted();
void on_buttonBox_rejected();
private:
Ui::FilePropertiesDialog *ui;
};
#endif // FILEPROPERTIESDIALOG_H
@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FilePropertiesDialog</class>
<widget class="QDialog" name="FilePropertiesDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="includeInBuild">
<property name="text">
<string>Include in Build</string>
</property>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
+153 -28
View File
@@ -2,12 +2,11 @@
#include "ui_newprojectdialog.h"
#include "projectpropertiesdialog.h"
#include "main.h"
#include <QFileDialog>
#include <QSettings>
NewProjectDialog::NewProjectDialog(QString windowTitle,QString defName,QString defPath, QWidget* parent) :
NewProjectDialog::NewProjectDialog(QString windowTitle,QString defName,QString defPath,bool addOnsOnly,QWidget* parent) :
QDialog(parent),
ui(new Ui::NewProjectDialog)
{
@@ -18,12 +17,42 @@ NewProjectDialog::NewProjectDialog(QString windowTitle,QString defName,QString d
setWindowTitle(windowTitle);
ui->name->setFocus();
ui->target->setItemData(0,"NES",Qt::UserRole);
ui->target->setItemData(1,"C64",Qt::UserRole);
ui->tabWidget->setCurrentIndex(0);
if ( addOnsOnly )
{
ui->tabWidget->setTabEnabled(0,false);
}
QDir templatesDir(":/templates/NES");
QStringList templates = templatesDir.entryList();
templates.removeAll("header.s_in");
ui->templateProject->addItem("Empty Project");
ui->templateProject->addItems(templates);
QDir addonsDir(":/addons/NES");
QStringList addons = addonsDir.entryList();
ui->addOnsList->addItems(addons);
int idx;
for ( idx = 0; idx < ui->addOnsList->count(); idx++ )
{
QListWidgetItem *pItem = ui->addOnsList->item(idx);
QString addon_uri = ":/addons/NES/"+pItem->text();
pItem->setData(Qt::UserRole,addon_uri);
if ( CNesicideProject::instance()->getProjectAddOns().contains(addon_uri) )
{
pItem->setCheckState(Qt::Checked);
}
else
{
pItem->setCheckState(Qt::Unchecked);
}
}
ui->addOnsList->installEventFilter(this);
}
NewProjectDialog::~NewProjectDialog()
@@ -45,6 +74,35 @@ void NewProjectDialog::changeEvent(QEvent* e)
}
}
bool NewProjectDialog::eventFilter(QObject *obj, QEvent *event)
{
int checkedCount = 0;
if ( obj == ui->addOnsList )
{
if ( event->type() == QEvent::Enter ||
event->type() == QEvent::Leave )
{
int idx;
for ( idx = 0; idx < ui->addOnsList->count(); idx++ )
{
QListWidgetItem* item = ui->addOnsList->item(idx);
item->setBackgroundColor(QColor(255,255,255,255));
if ( item->checkState() == Qt::Checked )
{
checkedCount++;
}
}
if ( !((checkedCount > 0) ||
(ui->addOnsList->selectedItems().count() > 0)) )
{
ui->addOnReadme->setHtml("");
}
}
}
}
QString NewProjectDialog::getName()
{
return ui->name->text();
@@ -60,6 +118,11 @@ QString NewProjectDialog::getTarget()
return ui->target->currentText();
}
QString NewProjectDialog::getTargetShort()
{
return ui->target->itemData(ui->target->currentIndex(),Qt::UserRole).toString();
}
QString NewProjectDialog::getTemplate()
{
return ui->templateProject->currentText();
@@ -70,6 +133,24 @@ int NewProjectDialog::getTemplateIndex()
return ui->templateProject->currentIndex();
}
QStringList NewProjectDialog::getAddOns()
{
QStringList addons;
int idx;
for ( idx = 0; idx < ui->addOnsList->count(); idx++ )
{
QListWidgetItem *pItem = ui->addOnsList->item(idx);
QString addon_uri = ":/addons/NES/"+pItem->text();
if ( pItem->checkState() == Qt::Checked )
{
addons << addon_uri;
}
}
return addons;
}
void NewProjectDialog::on_pathBrowse_clicked()
{
QSettings settings(QSettings::IniFormat, QSettings::UserScope, "CSPSoftware", "NESICIDE");
@@ -100,37 +181,29 @@ void NewProjectDialog::on_name_textChanged(QString /*text*/)
bool NewProjectDialog::checkValidity()
{
// Hackety hack (but then again so is using "new project dialog" for adding
// source files)
if( windowTitle() == "New Source" )
QDir check(ui->path->text());
if ( !ui->path->text().isEmpty() && !ui->name->text().isEmpty() )
{
return !ui->name->text().isEmpty();
return true;
}
else
{
QDir check(ui->path->text());
if ( !ui->path->text().isEmpty() && !ui->name->text().isEmpty() )
{
return true;
}
else
{
return false;
}
return false;
}
}
void NewProjectDialog::on_buttonBox_accepted()
{
// If they hit Project Properties button then we're all set except for the project name may have changed.
if ( !nesicideProject->isInitialized() )
if ( !CNesicideProject::instance()->isInitialized() )
{
setupProject();
}
else
{
nesicideProject->setProjectTitle(getName());
CNesicideProject::instance()->setProjectTitle(getName());
CNesicideProject::instance()->setDirty(true);
}
}
@@ -148,35 +221,54 @@ void NewProjectDialog::setupProject()
// Set project target before initializing project...
if ( getTarget() == "Commodore 64" )
{
nesicideProject->setProjectTarget("c64");
CNesicideProject::instance()->setProjectTarget("c64");
}
else if ( getTarget() == "Nintendo Entertainment System" )
{
nesicideProject->setProjectTarget("nes");
CNesicideProject::instance()->setProjectTarget("nes");
}
nesicideProject->initializeProject();
nesicideProject->setDirty(true);
nesicideProject->setProjectTitle(getName());
CNesicideProject::instance()->initializeProject();
CNesicideProject::instance()->setDirty(true);
CNesicideProject::instance()->setProjectTitle(getName());
}
void NewProjectDialog::on_target_currentIndexChanged(QString target)
{
QStringList templates;
QStringList addons;
QString addonsLoc;
ui->templateProject->clear();
ui->templateProject->addItem("Empty Project");
ui->addOnsList->clear();
if ( target == "Nintendo Entertainment System" )
{
QDir templatesDir(":/templates/NES");
templates = templatesDir.entryList();
templates.removeAll("header.s_in");
QDir addonsDir(":/addons/NES");
addonsLoc = ":/addons/NES";
addons = addonsDir.entryList();
}
else if ( target == "Commodore 64" )
{
QDir templatesDir(":/templates/C64");
templates = templatesDir.entryList();
templates.removeAll("header.s_in");
QDir addonsDir(":/addons/C64");
addonsLoc = ":/addons/C64";
addons = addonsDir.entryList();
}
ui->templateProject->addItems(templates);
ui->addOnsList->addItems(addons);
int idx;
for ( idx = 0; idx < ui->addOnsList->count(); idx++ )
{
QListWidgetItem *pItem = ui->addOnsList->item(idx);
pItem->setCheckState(Qt::Unchecked);
pItem->setData(Qt::UserRole,addonsLoc+pItem->text());
}
}
void NewProjectDialog::on_projectProperties_clicked()
@@ -189,10 +281,43 @@ void NewProjectDialog::on_projectProperties_clicked()
if (dlg->exec() == QDialog::Accepted)
{
nesicideProject->setDirty(true);
CNesicideProject::instance()->setDirty(true);
// They might have changed the project name...
ui->name->setText(nesicideProject->getProjectTitle());
ui->name->setText(CNesicideProject::instance()->getProjectTitle());
}
delete dlg;
}
void NewProjectDialog::on_addOnsList_itemClicked(QListWidgetItem *item)
{
QString readmeFileName = ":/addons/";
readmeFileName += getTargetShort();
readmeFileName += "/";
readmeFileName += item->text();
readmeFileName += "/README.HTM";
item->setBackgroundColor(QColor(248,248,248,255));
QFileInfo fi(readmeFileName);
if ( fi.exists() )
{
QFile f(readmeFileName);
if ( f.open(QIODevice::ReadOnly) )
{
QByteArray b = f.readAll();
ui->addOnReadme->setHtml(b);
}
}
else
{
ui->addOnReadme->setHtml("");
}
}
void NewProjectDialog::on_addOnsList_itemEntered(QListWidgetItem *item)
{
on_addOnsList_itemClicked(item);
}
+7 -1
View File
@@ -2,6 +2,7 @@
#define NEWPROJECTDIALOG_H
#include <QDialog>
#include <QListWidgetItem>
namespace Ui
{
@@ -12,17 +13,20 @@ class NewProjectDialog : public QDialog
{
Q_OBJECT
public:
NewProjectDialog(QString windowTitle = "New",QString defName = "", QString defPath = "", QWidget* parent = 0);
NewProjectDialog(QString windowTitle = "New",QString defName = "", QString defPath = "", bool addOnsOnly = false, QWidget* parent = 0);
virtual ~NewProjectDialog();
QString getName();
QString getPath();
QString getTarget();
QString getTargetShort();
QString getTemplate();
int getTemplateIndex();
QStringList getAddOns();
protected:
void changeEvent(QEvent* e);
bool checkValidity();
bool eventFilter(QObject *obj, QEvent *event);
private:
Ui::NewProjectDialog* ui;
@@ -35,6 +39,8 @@ private slots:
void on_path_textChanged(QString text);
void on_pathBrowse_clicked();
void on_projectProperties_clicked();
void on_addOnsList_itemClicked(QListWidgetItem *item);
void on_addOnsList_itemEntered(QListWidgetItem *item);
};
#endif // NEWPROJECTDIALOG_H
+152 -72
View File
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>433</width>
<height>317</height>
<width>598</width>
<height>402</height>
</rect>
</property>
<property name="windowTitle">
@@ -41,75 +41,45 @@
<string>General</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>12</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>12</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
<property name="spacing">
<number>6</number>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="name">
<property name="inputMethodHints">
<set>Qt::ImhNone</set>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QGroupBox" name="pathGroup">
<property name="title">
<string>Path</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLineEdit" name="path">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pathBrowse">
<property name="text">
<string>Browse...</string>
</property>
<property name="icon">
<iconset resource="../../../common/resource.qrc">
<normaloff>:/resources/document-open.png</normaloff>:/resources/document-open.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="templateGroup">
<property name="title">
<string>Template Project</string>
</property>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Template:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="templateProject"/>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Target Machine:</string>
</property>
</widget>
<item>
<widget class="QLineEdit" name="path">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pathBrowse">
<property name="text">
<string>Browse...</string>
</property>
<property name="icon">
<iconset resource="../../../common/resource.qrc">
<normaloff>:/resources/document-open.png</normaloff>:/resources/document-open.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="target">
@@ -125,6 +95,118 @@
</item>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="name">
<property name="inputMethodHints">
<set>Qt::ImhNone</set>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="templateProject">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Template Project:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Project Path:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Name:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Target Machine:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="addOns">
<attribute name="title">
<string>Add-Ons</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>12</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<property name="bottomMargin">
<number>12</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QListWidget" name="addOnsList">
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QTextEdit" name="addOnReadme">
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustIgnored</enum>
</property>
<property name="undoRedoEnabled">
<bool>false</bool>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="acceptRichText">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
@@ -133,8 +215,6 @@
</widget>
<resources>
<include location="../../../common/resource.qrc"/>
<include location="../../../common/resource.qrc"/>
<include location="../../../common/resource.qrc"/>
</resources>
<connections>
<connection>
+131 -82
View File
@@ -11,15 +11,13 @@
#include <QStringListModel>
#include "main.h"
const char hexStr[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
ProjectPropertiesDialog::ProjectPropertiesDialog(QWidget* parent) :
QDialog(parent),
ui(new Ui::ProjectPropertiesDialog)
{
QList<QColor> *pal = nesicideProject->getProjectPaletteEntries();
QList<QColor> *pal = CNesicideProject::instance()->getProjectPaletteEntries();
int i = 0;
char mapperTag [ 64 ];
@@ -30,26 +28,26 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QWidget* parent) :
ui->setupUi(this);
// Common project properties.
ui->projectNameLineEdit->setText(nesicideProject->getProjectTitle());
ui->projectNameLineEdit->setText(CNesicideProject::instance()->getProjectTitle());
ui->projectBasePath->setText(QDir::fromNativeSeparators(QDir::currentPath()));
ui->projectOutputBasePath->setText(nesicideProject->getProjectOutputBasePath());
ui->outputName->setText(nesicideProject->getProjectOutputName());
ui->compilerDefinedSymbols->setText(nesicideProject->getCompilerDefinedSymbols());
ui->compilerIncludePaths->setText(nesicideProject->getCompilerIncludePaths());
ui->compilerAdditionalOptions->setText(nesicideProject->getCompilerAdditionalOptions());
ui->assemblerDefinedSymbols->setText(nesicideProject->getAssemblerDefinedSymbols());
ui->assemblerIncludePaths->setText(nesicideProject->getAssemblerIncludePaths());
ui->assemblerAdditionalOptions->setText(nesicideProject->getAssemblerAdditionalOptions());
ui->linkerOutputName->setText(nesicideProject->getProjectLinkerOutputName());
ui->debugInfoName->setText(nesicideProject->getProjectDebugInfoName());
ui->linkerAdditionalOptions->setText(nesicideProject->getLinkerAdditionalOptions());
ui->linkerAdditionalDependencies->setText(nesicideProject->getLinkerAdditionalDependencies());
ui->linkerConfigFile->setText(nesicideProject->getLinkerConfigFile());
ui->projectOutputBasePath->setText(CNesicideProject::instance()->getProjectOutputBasePath());
ui->outputName->setText(CNesicideProject::instance()->getProjectOutputName());
ui->compilerDefinedSymbols->setText(CNesicideProject::instance()->getCompilerDefinedSymbols());
ui->compilerIncludePaths->setText(CNesicideProject::instance()->getCompilerIncludePaths());
ui->compilerAdditionalOptions->setText(CNesicideProject::instance()->getCompilerAdditionalOptions());
ui->assemblerDefinedSymbols->setText(CNesicideProject::instance()->getAssemblerDefinedSymbols());
ui->assemblerIncludePaths->setText(CNesicideProject::instance()->getAssemblerIncludePaths());
ui->assemblerAdditionalOptions->setText(CNesicideProject::instance()->getAssemblerAdditionalOptions());
ui->linkerOutputName->setText(CNesicideProject::instance()->getProjectLinkerOutputName());
ui->debugInfoName->setText(CNesicideProject::instance()->getProjectDebugInfoName());
ui->linkerAdditionalOptions->setText(CNesicideProject::instance()->getLinkerAdditionalOptions());
ui->linkerAdditionalDependencies->setText(CNesicideProject::instance()->getLinkerAdditionalDependencies());
ui->linkerConfigFile->setText(CNesicideProject::instance()->getLinkerConfigFile());
deserializeLinkerConfig();
ui->customRuleFile->setText(nesicideProject->getMakefileCustomRulesFile());
ui->customRuleFiles->addItems(CNesicideProject::instance()->getMakefileCustomRuleFiles());
deserializeCustomRules();
ui->sourceSearchList->setModel(new QStringListModel(nesicideProject->getSourceSearchPaths()));
ui->sourceSearchList->setModel(new QStringListModel(CNesicideProject::instance()->getSourceSearchPaths()));
ui->addSearchPath->setEnabled(false);
ui->removeSearchPath->setEnabled(false);
@@ -58,25 +56,25 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QWidget* parent) :
ui->linkerConfig->setText("Select a file to store linker configuration in, then modify it here.");
ui->linkerConfig->setEnabled(false);
}
if ( ui->customRuleFile->text().isEmpty() )
if ( ui->customRuleFiles->currentText().isEmpty() )
{
ui->customRules->setText("Select a file to store custom makefile rules in, then modify it here.");
ui->customRules->setEnabled(false);
}
// NES-specific project properties.
ui->projectHeaderName->setText(nesicideProject->getProjectHeaderFileName());
ui->projectSourceName->setText(nesicideProject->getProjectSourceFileName());
ui->prgromOutputBasePath->setText(nesicideProject->getProjectLinkerOutputBasePath());
ui->chrromOutputBasePath->setText(nesicideProject->getProjectCHRROMOutputBasePath());
ui->chrromOutputName->setText(nesicideProject->getProjectCHRROMOutputName());
ui->chrRom->setChecked(nesicideProject->getProjectUsesCHRROM());
ui->chrRam->setChecked(!nesicideProject->getProjectUsesCHRROM());
ui->cartridgeOutputName->setText(nesicideProject->getProjectCartridgeOutputName());
ui->cartridgeSaveStateName->setText(nesicideProject->getProjectCartridgeSaveStateName());
ui->projectHeaderName->setText(CNesicideProject::instance()->getProjectHeaderFileName());
ui->projectSourceName->setText(CNesicideProject::instance()->getProjectSourceFileName());
ui->prgromOutputBasePath->setText(CNesicideProject::instance()->getProjectLinkerOutputBasePath());
ui->chrromOutputBasePath->setText(CNesicideProject::instance()->getProjectCHRROMOutputBasePath());
ui->chrromOutputName->setText(CNesicideProject::instance()->getProjectCHRROMOutputName());
ui->chrRom->setChecked(CNesicideProject::instance()->getProjectUsesCHRROM());
ui->chrRam->setChecked(!CNesicideProject::instance()->getProjectUsesCHRROM());
ui->cartridgeOutputName->setText(CNesicideProject::instance()->getProjectCartridgeOutputName());
ui->cartridgeSaveStateName->setText(CNesicideProject::instance()->getProjectCartridgeSaveStateName());
ui->trainerPresent->setChecked(false);
ui->saveRAMPresent->setChecked(nesicideProject->getCartridge()->isBatteryBackedRam());
ui->extraVRAMPresent->setChecked(nesicideProject->getCartridge()->getFourScreen());
ui->saveRAMPresent->setChecked(CNesicideProject::instance()->getCartridge()->isBatteryBackedRam());
ui->extraVRAMPresent->setChecked(CNesicideProject::instance()->getCartridge()->getFourScreen());
// C64-specific project properties.
@@ -113,13 +111,13 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QWidget* parent) :
i++;
}
CCartridge* pCartridge = nesicideProject->getCartridge();
CCartridge* pCartridge = CNesicideProject::instance()->getCartridge();
ui->mapperComboBox->setCurrentIndex(mapperIndexFromID(pCartridge->getMapperNumber()));
ui->romTypeComboBox->setCurrentIndex(0);
ui->mirroringComboBox->setCurrentIndex(pCartridge->getMirrorMode());
tilePropertyListModel = new CPropertyListModel(false);
tilePropertyListModel->setItems(nesicideProject->getTileProperties());
tilePropertyListModel->setItems(CNesicideProject::instance()->getTileProperties());
ui->propertyTableView->setModel(tilePropertyListModel);
QObject::connect(ui->sourceSearchList->selectionModel(),SIGNAL(selectionChanged(QItemSelection,QItemSelection)),this,SLOT(sourceSearchList_selectionChanged(QItemSelection,QItemSelection)));
@@ -137,7 +135,7 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QWidget* parent) :
pageMap.insert("System Palette",ui->nessystempalette);
ui->treeWidget->setCurrentItem(ui->treeWidget->findItems("Project",Qt::MatchExactly).at(0));
if ( !nesicideProject->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
if ( !CNesicideProject::instance()->getProjectTarget().compare("nes",Qt::CaseInsensitive) )
{
QList<QTreeWidgetItem*> items = ui->treeWidget->findItems("Commodore 64",Qt::MatchExactly);
if ( items.count() )
@@ -145,7 +143,7 @@ ProjectPropertiesDialog::ProjectPropertiesDialog(QWidget* parent) :
items.at(0)->setHidden(true);
}
}
else if ( !nesicideProject->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
else if ( !CNesicideProject::instance()->getProjectTarget().compare("c64",Qt::CaseInsensitive) )
{
QList<QTreeWidgetItem*> items = ui->treeWidget->findItems("Nintendo Entertainment System",Qt::MatchExactly);
if ( items.count() )
@@ -497,43 +495,49 @@ void ProjectPropertiesDialog::on_assemblerIncludePathBrowse_clicked()
void ProjectPropertiesDialog::on_buttonBox_accepted()
{
nesicideProject->setProjectTitle(ui->projectNameLineEdit->text());
nesicideProject->setProjectOutputBasePath(ui->projectOutputBasePath->text());
nesicideProject->setProjectOutputName(ui->outputName->text());
nesicideProject->setProjectHeaderFileName(ui->projectHeaderName->text());
nesicideProject->setProjectSourceFileName(ui->projectSourceName->text());
nesicideProject->setProjectLinkerOutputName(ui->linkerOutputName->text());
nesicideProject->setProjectDebugInfoName(ui->debugInfoName->text());
nesicideProject->setProjectCHRROMOutputBasePath(ui->chrromOutputBasePath->text());
nesicideProject->setProjectCHRROMOutputName(ui->chrromOutputName->text());
nesicideProject->setProjectUsesCHRROM(ui->chrRom->isChecked());
nesicideProject->setProjectCartridgeOutputName(ui->cartridgeOutputName->text());
nesicideProject->setProjectCartridgeSaveStateName(ui->cartridgeSaveStateName->text());
nesicideProject->setCompilerDefinedSymbols(ui->compilerDefinedSymbols->text());
nesicideProject->setCompilerIncludePaths(ui->compilerIncludePaths->text());
nesicideProject->setCompilerAdditionalOptions(ui->compilerAdditionalOptions->text());
nesicideProject->setAssemblerDefinedSymbols(ui->assemblerDefinedSymbols->text());
nesicideProject->setAssemblerIncludePaths(ui->assemblerIncludePaths->text());
nesicideProject->setAssemblerAdditionalOptions(ui->assemblerAdditionalOptions->text());
nesicideProject->setProjectLinkerOutputBasePath(ui->prgromOutputBasePath->text());
nesicideProject->setLinkerAdditionalOptions(ui->linkerAdditionalOptions->text());
nesicideProject->setLinkerAdditionalDependencies(ui->linkerAdditionalDependencies->text());
nesicideProject->setTileProperties(tilePropertyListModel->getItems());
nesicideProject->setLinkerConfigFile(ui->linkerConfigFile->text());
CNesicideProject::instance()->setProjectTitle(ui->projectNameLineEdit->text());
CNesicideProject::instance()->setProjectOutputBasePath(ui->projectOutputBasePath->text());
CNesicideProject::instance()->setProjectOutputName(ui->outputName->text());
CNesicideProject::instance()->setProjectHeaderFileName(ui->projectHeaderName->text());
CNesicideProject::instance()->setProjectSourceFileName(ui->projectSourceName->text());
CNesicideProject::instance()->setProjectLinkerOutputName(ui->linkerOutputName->text());
CNesicideProject::instance()->setProjectDebugInfoName(ui->debugInfoName->text());
CNesicideProject::instance()->setProjectCHRROMOutputBasePath(ui->chrromOutputBasePath->text());
CNesicideProject::instance()->setProjectCHRROMOutputName(ui->chrromOutputName->text());
CNesicideProject::instance()->setProjectUsesCHRROM(ui->chrRom->isChecked());
CNesicideProject::instance()->setProjectCartridgeOutputName(ui->cartridgeOutputName->text());
CNesicideProject::instance()->setProjectCartridgeSaveStateName(ui->cartridgeSaveStateName->text());
CNesicideProject::instance()->setCompilerDefinedSymbols(ui->compilerDefinedSymbols->text());
CNesicideProject::instance()->setCompilerIncludePaths(ui->compilerIncludePaths->text());
CNesicideProject::instance()->setCompilerAdditionalOptions(ui->compilerAdditionalOptions->text());
CNesicideProject::instance()->setAssemblerDefinedSymbols(ui->assemblerDefinedSymbols->text());
CNesicideProject::instance()->setAssemblerIncludePaths(ui->assemblerIncludePaths->text());
CNesicideProject::instance()->setAssemblerAdditionalOptions(ui->assemblerAdditionalOptions->text());
CNesicideProject::instance()->setProjectLinkerOutputBasePath(ui->prgromOutputBasePath->text());
CNesicideProject::instance()->setLinkerAdditionalOptions(ui->linkerAdditionalOptions->text());
CNesicideProject::instance()->setLinkerAdditionalDependencies(ui->linkerAdditionalDependencies->text());
CNesicideProject::instance()->setTileProperties(tilePropertyListModel->getItems());
CNesicideProject::instance()->setLinkerConfigFile(ui->linkerConfigFile->text());
serializeLinkerConfig();
nesicideProject->setMakefileCustomRulesFile(ui->customRuleFile->text());
QStringList customRuleFiles;
int idx;
for ( idx = 0; idx < ui->customRuleFiles->count(); idx++ )
{
customRuleFiles += ui->customRuleFiles->itemText(idx);
}
CNesicideProject::instance()->setMakefileCustomRuleFiles(customRuleFiles);
serializeCustomRules();
nesicideProject->getProjectPaletteEntries()->clear();
CNesicideProject::instance()->getProjectPaletteEntries()->clear();
for (int paletteItemIndex=0; paletteItemIndex<currentPalette.count(); paletteItemIndex++)
{
nesicideProject->getProjectPaletteEntries()->append(currentPalette.at(paletteItemIndex));
CNesicideProject::instance()->getProjectPaletteEntries()->append(currentPalette.at(paletteItemIndex));
}
nesicideProject->getCartridge()->setMapperNumber(mapperIDFromIndex(ui->mapperComboBox->currentIndex()));
nesicideProject->getCartridge()->setMirrorMode((eMirrorMode)ui->mirroringComboBox->currentIndex());
nesicideProject->getCartridge()->setFourScreen(ui->extraVRAMPresent->isChecked());
CNesicideProject::instance()->getCartridge()->setMapperNumber(mapperIDFromIndex(ui->mapperComboBox->currentIndex()));
CNesicideProject::instance()->getCartridge()->setMirrorMode((eMirrorMode)ui->mirroringComboBox->currentIndex());
CNesicideProject::instance()->getCartridge()->setFourScreen(ui->extraVRAMPresent->isChecked());
}
void ProjectPropertiesDialog::on_projectOutputBasePathBrowse_clicked()
@@ -571,7 +575,7 @@ void ProjectPropertiesDialog::on_projectNameLineEdit_textEdited(QString )
void ProjectPropertiesDialog::on_linkerConfigFileBrowse_clicked()
{
QString value = QFileDialog::getSaveFileName(this,"Linker Config File",QDir::currentPath());
QString value = QFileDialog::getOpenFileName(this,"Linker Config File",QDir::currentPath());
QDir dir(QDir::currentPath());
if ( !value.isEmpty() )
@@ -751,22 +755,34 @@ void ProjectPropertiesDialog::on_editProperty_clicked()
void ProjectPropertiesDialog::on_treeWidget_itemSelectionChanged()
{
ui->treeWidget->expand(ui->treeWidget->currentIndex());
if ( ui->treeWidget->currentItem()->childCount() )
QModelIndexList indexes = ui->treeWidget->selectionModel()->selectedIndexes();
QList<QTreeWidgetItem*> items = ui->treeWidget->selectedItems();
if ( indexes.count() > 0 )
{
ui->treeWidget->setCurrentItem(ui->treeWidget->itemBelow(ui->treeWidget->currentItem()));
// Single selection
QModelIndex index = indexes.at(0);
QTreeWidgetItem *pItem = items.at(0);
ui->treeWidget->expand(index);
if ( pItem->childCount() )
{
ui->treeWidget->setCurrentItem(ui->treeWidget->itemBelow(pItem));
}
ui->stackedWidget->setCurrentWidget(pageMap[pItem->text(0)]);
}
ui->stackedWidget->setCurrentWidget(pageMap[ui->treeWidget->currentItem()->text(0)]);
}
void ProjectPropertiesDialog::serializeCustomRules()
void ProjectPropertiesDialog::serializeCustomRules(QString rulesFile)
{
if ( !ui->customRuleFile->text().isEmpty() )
if ( rulesFile.isEmpty() )
{
rulesFile = ui->customRuleFiles->currentText();
}
if ( !rulesFile.isEmpty() )
{
if ( customRulesChanged )
{
QDir dir(QDir::currentPath());
QFile fileOut(dir.filePath(ui->customRuleFile->text()));
QFile fileOut(dir.filePath(ui->customRuleFiles->currentText()));
fileOut.open(QIODevice::ReadWrite|QIODevice::Truncate|QIODevice::Text);
if ( fileOut.isOpen() )
@@ -776,7 +792,7 @@ void ProjectPropertiesDialog::serializeCustomRules()
}
else
{
QMessageBox::critical(0,"File I/O Error", "Could not write custom rules file:\n"+ui->customRuleFile->text());
QMessageBox::critical(0,"File I/O Error", "Could not write custom rules file:\n"+rulesFile);
}
}
@@ -788,9 +804,9 @@ void ProjectPropertiesDialog::deserializeCustomRules()
{
QDir dir(QDir::currentPath());
if ( !ui->customRuleFile->text().isEmpty() )
if ( !ui->customRuleFiles->currentText().isEmpty() )
{
QFile fileIn(dir.filePath(ui->customRuleFile->text()));
QFile fileIn(dir.filePath(ui->customRuleFiles->currentText()));
if ( fileIn.exists() )
{
@@ -802,7 +818,7 @@ void ProjectPropertiesDialog::deserializeCustomRules()
}
else
{
QMessageBox::critical(0,"File I/O Error", "Could not read custom rules file:\n"+ui->customRuleFile->text());
QMessageBox::critical(0,"File I/O Error", "Could not read custom rules file:\n"+ui->customRuleFiles->currentText());
}
}
@@ -818,12 +834,12 @@ void ProjectPropertiesDialog::on_customRules_textChanged()
void ProjectPropertiesDialog::on_customRuleFileBrowse_clicked()
{
QString value = QFileDialog::getSaveFileName(this,"Custom Rule File",QDir::currentPath());
QString value = QFileDialog::getOpenFileName(this,"Custom Rule File",QDir::currentPath());
QDir dir(QDir::currentPath());
if ( !value.isEmpty() )
{
ui->customRuleFile->setText(dir.fromNativeSeparators(dir.relativeFilePath(value)));
ui->customRuleFiles->addItem(dir.fromNativeSeparators(dir.relativeFilePath(value)));
ui->customRules->setEnabled(true);
ui->customRules->setText("");
}
@@ -837,8 +853,8 @@ void ProjectPropertiesDialog::sourceSearchList_selectionChanged(QItemSelection,Q
void ProjectPropertiesDialog::on_addSearchPath_clicked()
{
nesicideProject->addSourceSearchPath(ui->sourceSearchPath->text());
((QStringListModel*)ui->sourceSearchList->model())->setStringList(nesicideProject->getSourceSearchPaths());
CNesicideProject::instance()->addSourceSearchPath(ui->sourceSearchPath->text());
((QStringListModel*)ui->sourceSearchList->model())->setStringList(CNesicideProject::instance()->getSourceSearchPaths());
}
void ProjectPropertiesDialog::on_removeSearchPath_clicked()
@@ -846,9 +862,9 @@ void ProjectPropertiesDialog::on_removeSearchPath_clicked()
QModelIndexList selections = ui->sourceSearchList->selectionModel()->selectedRows();
foreach ( QModelIndex index, selections )
{
nesicideProject->removeSourceSearchPath(index.data().toString());
CNesicideProject::instance()->removeSourceSearchPath(index.data().toString());
}
((QStringListModel*)ui->sourceSearchList->model())->setStringList(nesicideProject->getSourceSearchPaths());
((QStringListModel*)ui->sourceSearchList->model())->setStringList(CNesicideProject::instance()->getSourceSearchPaths());
}
void ProjectPropertiesDialog::on_sourceSearchPathBrowse_clicked()
@@ -858,3 +874,36 @@ void ProjectPropertiesDialog::on_sourceSearchPathBrowse_clicked()
ui->sourceSearchPath->setText(value);
ui->addSearchPath->setEnabled(!value.isEmpty());
}
void ProjectPropertiesDialog::on_linkerConfigFileNew_clicked()
{
QString value = QFileDialog::getSaveFileName(this,"Linker Config File",QDir::currentPath());
QDir dir(QDir::currentPath());
if ( !value.isEmpty() )
{
ui->linkerConfigFile->setText(dir.fromNativeSeparators(dir.relativeFilePath(value)));
ui->linkerConfig->setEnabled(true);
ui->linkerConfig->setText("");
}
deserializeLinkerConfig();
}
void ProjectPropertiesDialog::on_customRuleFiles_currentTextChanged(const QString &arg1)
{
if ( customRulesChanged )
{
serializeCustomRules(currentCustomRulesFile);
}
currentCustomRulesFile = arg1;
deserializeCustomRules();
}
void ProjectPropertiesDialog::on_customRuleFileRemove_clicked()
{
if ( ui->customRuleFiles->currentIndex() >= 0 )
{
ui->customRuleFiles->removeItem(ui->customRuleFiles->currentIndex());
}
}
+5 -1
View File
@@ -28,7 +28,7 @@ protected:
void changeEvent(QEvent* e);
void serializeLinkerConfig();
void deserializeLinkerConfig();
void serializeCustomRules();
void serializeCustomRules(QString rulesFile = QString());
void deserializeCustomRules();
private:
@@ -37,6 +37,7 @@ private:
QList<QColor> currentPalette;
bool linkerConfigChanged;
bool customRulesChanged;
QString currentCustomRulesFile;
CPropertyListModel* tilePropertyListModel;
QMap<QString,QWidget*> pageMap;
@@ -69,6 +70,9 @@ private slots:
void on_addSearchPath_clicked();
void on_removeSearchPath_clicked();
void on_sourceSearchPathBrowse_clicked();
void on_linkerConfigFileNew_clicked();
void on_customRuleFiles_currentTextChanged(const QString &arg1);
void on_customRuleFileRemove_clicked();
};
#endif // PROJECTPROPERTIESDIALOG_H
+94 -52
View File
@@ -111,7 +111,7 @@
<enum>QFrame::NoFrame</enum>
</property>
<property name="currentIndex">
<number>7</number>
<number>5</number>
</property>
<widget class="QWidget" name="project">
<layout class="QGridLayout" name="gridLayout_8">
@@ -476,6 +476,17 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="linkerConfigFileNew">
<property name="text">
<string>New</string>
</property>
<property name="icon">
<iconset resource="../../../common/resource.qrc">
<normaloff>:/resources/22_document-new.png</normaloff>:/resources/22_document-new.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="linkerConfigFileBrowse">
<property name="text">
@@ -609,45 +620,78 @@
<property name="bottomMargin">
<number>0</number>
</property>
<item row="1" column="0" colspan="2">
<item row="3" column="0" colspan="2">
<widget class="QTextEdit" name="customRules"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_31">
<property name="text">
<string>Build rules entered here will appear verbatim in the specified file.</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QTextEdit" name="customRules"/>
</item>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_9">
<item>
<widget class="QLineEdit" name="customRuleFile">
<property name="readOnly">
<bool>true</bool>
<item row="0" column="0" colspan="2">
<layout class="QFormLayout" name="formLayout_6">
<property name="horizontalSpacing">
<number>6</number>
</property>
<property name="verticalSpacing">
<number>6</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_32">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Custom rule file:</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="customRuleFileBrowse">
<property name="text">
<string>Browse...</string>
<item row="0" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="1,0,0">
<property name="spacing">
<number>6</number>
</property>
<property name="icon">
<iconset resource="../../../common/resource.qrc">
<normaloff>:/resources/document-open.png</normaloff>:/resources/document-open.png</iconset>
</property>
</widget>
<item>
<widget class="QComboBox" name="customRuleFiles">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="customRuleFileBrowse">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../common/resource.qrc">
<normaloff>:/resources/RR_page_white_add.png</normaloff>:/resources/RR_page_white_add.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="customRuleFileRemove">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../../../common/resource.qrc">
<normaloff>:/resources/RR_page_white_delete.png</normaloff>:/resources/RR_page_white_delete.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_32">
<property name="text">
<string>Custom rule file:</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="nesgraphicsbuilder">
@@ -701,29 +745,6 @@
</layout>
</widget>
</item>
<item row="2" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>CHR Data Location</string>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0">
<widget class="QRadioButton" name="chrRom">
<property name="text">
<string>CHR Data in CHR-ROM</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="chrRam">
<property name="text">
<string>CHR Data in CHR-RAM</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
@@ -737,6 +758,29 @@
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>CHR Data Location</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QRadioButton" name="chrRam">
<property name="text">
<string>CHR Data in CHR-RAM</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="chrRom">
<property name="text">
<string>CHR Data in CHR-ROM</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="nescartridge">
@@ -1305,8 +1349,6 @@
</widget>
<resources>
<include location="../../../common/resource.qrc"/>
<include location="../../../common/resource.qrc"/>
<include location="../../../common/resource.qrc"/>
</resources>
<connections>
<connection>
+5 -11
View File
@@ -6,22 +6,16 @@ QsciAPIsCA65::QsciAPIsCA65(QsciLexer *lexer)
}
QsciAPIsCA65::~QsciAPIsCA65()
{
}
//! \reimp
void QsciAPIsCA65::updateAutoCompletionList(const QStringList &context,
QStringList &list)
{
QsciAPIs::updateAutoCompletionList(context,list);
qDebug("updateAutoCompletionList: context=[");
foreach ( QString str, context )
{
qDebug(str.toUtf8().data());
}
qDebug("], list=[");
foreach ( QString str, list )
{
qDebug(str.toUtf8().data());
}
qDebug("]");
}
//! \reimp
+1 -2
View File
@@ -7,10 +7,9 @@
class QsciAPIsCA65 : public QsciAPIs
{
Q_OBJECT
public:
QsciAPIsCA65(QsciLexer *lexer);
virtual ~QsciAPIsCA65();
//! \reimp
virtual void updateAutoCompletionList(const QStringList &context,
+39
View File
@@ -20,3 +20,42 @@ QsciLexerCC65::QsciLexerCC65(QObject */*parent*/)
QsciLexerCC65::~QsciLexerCC65()
{
}
QFont QsciLexerCC65::defaultFont() const
{
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
return QFont("Monaco", 11);
#endif
#ifdef Q_OS_LINUX
return QFont("Monospace", 10);
#endif
#ifdef Q_OS_WIN
return QFont("Consolas", 11);
#endif
}
QFont QsciLexerCC65::defaultFont(int style) const
{
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
return QFont("Monaco", 11);
#endif
#ifdef Q_OS_LINUX
return QFont("Monospace", 10);
#endif
#ifdef Q_OS_WIN
return QFont("Consolas", 11);
#endif
}
QFont QsciLexerCC65::font(int style) const
{
#if defined(Q_OS_MAC) || defined(Q_OS_MACX) || defined(Q_OS_MAC64)
return QFont("Monaco", 11);
#endif
#ifdef Q_OS_LINUX
return QFont("Monospace", 10);
#endif
#ifdef Q_OS_WIN
return QFont("Consolas", 11);
#endif
}
+5
View File
@@ -13,6 +13,11 @@ class QsciLexerCC65 : public QsciLexerCPP
public:
QsciLexerCC65(QObject *parent = 0);
virtual ~QsciLexerCC65();
virtual QFont defaultFont() const;
virtual QFont defaultFont(int style) const;
virtual QFont font(int style) const;
};
#endif // QSCILEXERCC65_H

Some files were not shown because too many files have changed in this diff Show More