From 4139e2f77eb603083f26c0854e09c3e7840b6314 Mon Sep 17 00:00:00 2001 From: Thiemo Tiziani Date: Sun, 15 Nov 2026 22:59:42 +0100 Subject: [PATCH] site 2.0.2: phase meter 1.3.0 (V2 tick spacing follows each player's tempo) Co-Authored-By: Claude Opus 5.5 --- assets/versions.js | 3 ++- builder/data.js | 2 +- builder/py/bundle.json | 2 +- builder/ui.js | 2 +- docs.html | 2 +- index.html | 2 +- tools/changelog.json | 1 + tools/flash_sizes.json | 40 ++++++++++++++++++++++++++++++++++++++++ 8 files changed, 48 insertions(+), 6 deletions(-) diff --git a/assets/versions.js b/assets/versions.js index 1a9d747..fbf738d 100644 --- a/assets/versions.js +++ b/assets/versions.js @@ -12,6 +12,7 @@ window.CDJ_VERSIONS = { "Known issues: the key colour on the player, hot cues after USB STOP and WAVEFORM with a track loaded are fixed and off the list.", "New screenshots: the comparison at the top and the Phase meter tile show the V2 phase meter, in phase with a second player as tempo master.", "Phase meter 1.2.0: V2 REVERSE; in V2 the bar ticks of both rulers meet in one line, green while the bars are in phase; no more torn ticks on the player.", + "Phase meter 1.3.0: in V2 the tick spacing follows each player's tempo, the master's and this deck's (a 70 BPM track's ticks twice as wide as a 140 BPM one's), so the ticks only line up once the tempos match.", "Quick search 0.7.0: BROWSE opens as fast as without the mod; held, SEARCH comes sooner and only the list stands still while it is on its way, the deck below (time, BPM, overview) goes on.", "Quick search 0.7.0: BROWSE twice goes to the playing track's list only with the browse screen open (half a second or more); from the normal screen two presses open and close it as on a stock player.", "Browse info 0.2.0: reads BPM and key only while the player is not loading a list, so lists and SEARCH no longer wait for it.", @@ -265,7 +266,7 @@ window.CDJ_VERSIONS = { ], "mods": { "extended_bpm": "1.0.0", - "phasemeter": "1.2.0", + "phasemeter": "1.3.0", "advanced_waveforms": "1.4.0", "beatjump": "1.0.2", "cuecolours": "1.0.1", diff --git a/builder/data.js b/builder/data.js index 466a5e7..ed62831 100644 --- a/builder/data.js +++ b/builder/data.js @@ -1,2 +1,2 @@ // Generated by tools/make_builder_data.py -- do not edit. -window.BUILDER_DATA = {"stockUpdSha256":"e96bca7d1ac983985992a8e5fa7813e1ebf04bef514e0c6cfd0a8375f667f7f9","stockAppSha256":"1ac3e30cde292865413950fe159663b3958e85939ed0a5d0122f796809a5f8ef","appSize":16519056,"dataBase":150744320,"upstream":{"extended_bpm":{"size":16576352,"ops":[["data",145914824,"45b88bcd5afea839"],["data",146586208,"c465a030b70c781e"],["data",146586876,"c465a030b70c781e"],["data",146618952,"c3967666e153796f"],["data",146619984,"7f0079b1f754ae7e"],["data",146620120,"a91a9b3491491b64"],["data",146829820,"f9e6d34295c320f0"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150739456,"786195378d06baff"],["data",150739521,"503c09b6b0baefb3"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"7010683be462baa0"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"172e933902cb3738"],["data",150742016,"2853d86b697a9dfa"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["assets",150744320,49760]]},"phasemeter":{"size":16576352,"ops":[["data",135069542,"845677fae2e67916"],["data",145914824,"45b88bcd5afea839"],["data",145941230,"6922e93e3827642c"],["data",145986008,"84014a74358fe2ac"],["data",145987228,"84014a74358fe2ac"],["data",145988312,"84014a74358fe2ac"],["data",146168552,"84014a74358fe2ac"],["data",146172320,"84014a74358fe2ac"],["data",146173504,"84014a74358fe2ac"],["data",146829820,"f9e6d34295c320f0"],["data",147236557,"371b074706e32cac"],["data",147246288,"060f2c4b6cd4c5e4"],["data",150411792,"845677fae2e67916"],["data",150427952,"845677fae2e67916"],["data",150446592,"845677fae2e67916"],["data",150464904,"845677fae2e67916"],["data",150483144,"845677fae2e67916"],["data",150501528,"845677fae2e67916"],["data",150519852,"845677fae2e67916"],["data",150538228,"845677fae2e67916"],["data",150556534,"845677fae2e67916"],["data",150572646,"845677fae2e67916"],["data",150587026,"845677fae2e67916"],["data",150601380,"845677fae2e67916"],["data",150619274,"845677fae2e67916"],["data",150637628,"845677fae2e67916"],["data",150655862,"845677fae2e67916"],["data",150673666,"845677fae2e67916"],["data",150692276,"845677fae2e67916"],["data",150709976,"845677fae2e67916"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150739456,"786195378d06baff"],["data",150739521,"503c09b6b0baefb3"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"7010683be462baa0"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"172e933902cb3738"],["data",150742016,"acf759afff056d54"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["assets",150744320,49760]]},"advanced_waveforms":{"size":16636928,"ops":[["data",144311836,"ca71ec9290d6ed48"],["data",146565168,"52b8fe18a1fed3bf"],["data",146565756,"a2721044eff0d2f6"],["data",146603378,"620bfdaa346b088f"],["data",146603856,"582d807f9ed58432"],["data",147243844,"d77596e8499df246"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150738944,"91aaac306bd43135"],["data",150739456,"786195378d06baff"],["data",150739521,"d5326732238d3e24"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"eede35a6260db6bf"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"bb010f4579136412"],["data",150742016,"9bed08a38f1020b6"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["data",150853648,"87741faeb81ce6a9"],["assets",150744320,50528]]},"extended_bpm,phasemeter":{"size":16576352,"ops":[["data",135069542,"845677fae2e67916"],["data",145914824,"45b88bcd5afea839"],["data",145941230,"6922e93e3827642c"],["data",145986008,"84014a74358fe2ac"],["data",145987228,"84014a74358fe2ac"],["data",145988312,"84014a74358fe2ac"],["data",146168552,"84014a74358fe2ac"],["data",146172320,"84014a74358fe2ac"],["data",146173504,"84014a74358fe2ac"],["data",146586208,"c465a030b70c781e"],["data",146586876,"c465a030b70c781e"],["data",146618952,"c3967666e153796f"],["data",146619984,"7f0079b1f754ae7e"],["data",146620120,"a91a9b3491491b64"],["data",146829820,"f9e6d34295c320f0"],["data",147236557,"371b074706e32cac"],["data",147246288,"060f2c4b6cd4c5e4"],["data",150411792,"845677fae2e67916"],["data",150427952,"845677fae2e67916"],["data",150446592,"845677fae2e67916"],["data",150464904,"845677fae2e67916"],["data",150483144,"845677fae2e67916"],["data",150501528,"845677fae2e67916"],["data",150519852,"845677fae2e67916"],["data",150538228,"845677fae2e67916"],["data",150556534,"845677fae2e67916"],["data",150572646,"845677fae2e67916"],["data",150587026,"845677fae2e67916"],["data",150601380,"845677fae2e67916"],["data",150619274,"845677fae2e67916"],["data",150637628,"845677fae2e67916"],["data",150655862,"845677fae2e67916"],["data",150673666,"845677fae2e67916"],["data",150692276,"845677fae2e67916"],["data",150709976,"845677fae2e67916"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150739456,"786195378d06baff"],["data",150739521,"503c09b6b0baefb3"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"7010683be462baa0"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"172e933902cb3738"],["data",150742016,"9e7532da7f56183c"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["assets",150744320,49760]]},"extended_bpm,advanced_waveforms":{"size":16636928,"ops":[["data",144311836,"ca71ec9290d6ed48"],["data",145914824,"45b88bcd5afea839"],["data",146565168,"52b8fe18a1fed3bf"],["data",146565756,"a2721044eff0d2f6"],["data",146586208,"c465a030b70c781e"],["data",146586876,"c465a030b70c781e"],["data",146603378,"620bfdaa346b088f"],["data",146603856,"582d807f9ed58432"],["data",146618952,"c3967666e153796f"],["data",146619984,"7f0079b1f754ae7e"],["data",146620120,"a91a9b3491491b64"],["data",146829820,"f9e6d34295c320f0"],["data",147243844,"d77596e8499df246"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150738944,"91aaac306bd43135"],["data",150739456,"786195378d06baff"],["data",150739521,"d5326732238d3e24"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"eede35a6260db6bf"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"bb010f4579136412"],["data",150742016,"2853d86b697a9dfa"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["data",150853648,"87741faeb81ce6a9"],["assets",150744320,50528]]},"phasemeter,advanced_waveforms":{"size":16636928,"ops":[["data",135069542,"845677fae2e67916"],["data",144311836,"ca71ec9290d6ed48"],["data",145914824,"45b88bcd5afea839"],["data",145941230,"6922e93e3827642c"],["data",145986008,"84014a74358fe2ac"],["data",145987228,"84014a74358fe2ac"],["data",145988312,"84014a74358fe2ac"],["data",146168552,"84014a74358fe2ac"],["data",146172320,"84014a74358fe2ac"],["data",146173504,"84014a74358fe2ac"],["data",146565168,"52b8fe18a1fed3bf"],["data",146565756,"a2721044eff0d2f6"],["data",146603378,"620bfdaa346b088f"],["data",146603856,"582d807f9ed58432"],["data",146829820,"f9e6d34295c320f0"],["data",147236557,"371b074706e32cac"],["data",147243844,"d77596e8499df246"],["data",147246288,"060f2c4b6cd4c5e4"],["data",150411792,"845677fae2e67916"],["data",150427952,"845677fae2e67916"],["data",150446592,"845677fae2e67916"],["data",150464904,"845677fae2e67916"],["data",150483144,"845677fae2e67916"],["data",150501528,"845677fae2e67916"],["data",150519852,"845677fae2e67916"],["data",150538228,"845677fae2e67916"],["data",150556534,"845677fae2e67916"],["data",150572646,"845677fae2e67916"],["data",150587026,"845677fae2e67916"],["data",150601380,"845677fae2e67916"],["data",150619274,"845677fae2e67916"],["data",150637628,"845677fae2e67916"],["data",150655862,"845677fae2e67916"],["data",150673666,"845677fae2e67916"],["data",150692276,"845677fae2e67916"],["data",150709976,"845677fae2e67916"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150738944,"91aaac306bd43135"],["data",150739456,"786195378d06baff"],["data",150739521,"d5326732238d3e24"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"eede35a6260db6bf"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"bb010f4579136412"],["data",150742016,"acf759afff056d54"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["data",150853648,"87741faeb81ce6a9"],["assets",150744320,50528]]},"extended_bpm,phasemeter,advanced_waveforms":{"size":16636928,"ops":[["data",135069542,"845677fae2e67916"],["data",144311836,"ca71ec9290d6ed48"],["data",145914824,"45b88bcd5afea839"],["data",145941230,"6922e93e3827642c"],["data",145986008,"84014a74358fe2ac"],["data",145987228,"84014a74358fe2ac"],["data",145988312,"84014a74358fe2ac"],["data",146168552,"84014a74358fe2ac"],["data",146172320,"84014a74358fe2ac"],["data",146173504,"84014a74358fe2ac"],["data",146565168,"52b8fe18a1fed3bf"],["data",146565756,"a2721044eff0d2f6"],["data",146586208,"c465a030b70c781e"],["data",146586876,"c465a030b70c781e"],["data",146603378,"620bfdaa346b088f"],["data",146603856,"582d807f9ed58432"],["data",146618952,"c3967666e153796f"],["data",146619984,"7f0079b1f754ae7e"],["data",146620120,"a91a9b3491491b64"],["data",146829820,"f9e6d34295c320f0"],["data",147236557,"371b074706e32cac"],["data",147243844,"d77596e8499df246"],["data",147246288,"060f2c4b6cd4c5e4"],["data",150411792,"845677fae2e67916"],["data",150427952,"845677fae2e67916"],["data",150446592,"845677fae2e67916"],["data",150464904,"845677fae2e67916"],["data",150483144,"845677fae2e67916"],["data",150501528,"845677fae2e67916"],["data",150519852,"845677fae2e67916"],["data",150538228,"845677fae2e67916"],["data",150556534,"845677fae2e67916"],["data",150572646,"845677fae2e67916"],["data",150587026,"845677fae2e67916"],["data",150601380,"845677fae2e67916"],["data",150619274,"845677fae2e67916"],["data",150637628,"845677fae2e67916"],["data",150655862,"845677fae2e67916"],["data",150673666,"845677fae2e67916"],["data",150692276,"845677fae2e67916"],["data",150709976,"845677fae2e67916"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150738944,"91aaac306bd43135"],["data",150739456,"786195378d06baff"],["data",150739521,"d5326732238d3e24"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"eede35a6260db6bf"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"bb010f4579136412"],["data",150742016,"9e7532da7f56183c"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["data",150853648,"87741faeb81ce6a9"],["assets",150744320,50528]]}},"expect":{"extended_bpm":"1150cc0099d890fb4b9e09cf19f03464106ffd5fd04b1fa940d5af0b41008c4a","phasemeter":"dca533375e39fed109c5b35aef80bcc036ed4500ee2e67f8f3ea3bb0309cdedb","advanced_waveforms":"d91dbf251c1c92ff06b41c28582e78fe2611d7e419b6cf0e9bdf7fadf8eb723d","extended_bpm,phasemeter":"5c663e5fdb53c791a75ee45de1a0875eb83fd247534a916403427cb35e578f14","extended_bpm,advanced_waveforms":"9b74c6fe5760b86c81217dc536ae98c2bf2f23f7552818ff1519f06862265b33","phasemeter,advanced_waveforms":"3343e8ee244a2afee30f8ca950019be6f99d3d4ccba702cff50913b342a02c1f","extended_bpm,phasemeter,advanced_waveforms":"cb991e829faf76cd8a64fbdc6a52852aac4daac2aaedd2f32a59db3bf222007e"},"chunks":{"45b88bcd5afea839":"ACX8","c465a030b70c781e":"ACL8","c3967666e153796f":"ACH8","7f0079b1f754ae7e":"AdErQQkACQAAEPwI","a91a9b3491491b64":"AdYrRgkACQAAEvwI","f9e6d34295c320f0":"ACT8","6d11cfe939a0630a":"hi+WLyJPCdj/4AEYCNELQQkAA2kCKAfREmEYIQGJ/+ABGJNgJk/2aQsA9mgALPwIACD8CKDSTQo=","a4d77ab57ab896dd":"Bi8WLyYvNi9GL1YvZi92LyJPEk8CTwNl42QM0QtBCQAL0QERBk8WTyZP9mf2ZvZl9mT2Y/Zi9mH2YGoFJ+YYRgTREHYE1wXSK0IJAAAU/AgALPwIhIurC1DDAADkPr0I","906ea135b6ba2cef":"Ek8CTw3REjQTiQ3REzUQiwzRFzUNiQzRHDVHBRoAC9EcMAvSJTAKAPPhHUAJ0RIwAIv/4AZPCwAWTwkA//8AAPDY////fwAAECcAAIgTAABZF7fRoIYB","d6db78bde1edbcae":"hi+WL6Yvti/GL9Yv5i8iTxJPAk/sfz7YglAIIAKJg1AIIAGLaKAJAIhbOtESOweJiVADagGIDYkCiAuJA4gJiTXRglQLQQDlM9GDVAtBAOVSoAkAM9ESabNk82XQsQkAo2ADiCkMgl2DVC/eNNrILAOJglSDXS3eMton0QtBAOXxVQBFKtEcNcw102Qj0QtBCQDTZAHlINELQQkAk2Q35fJmyCwDiSXlAEYi0Rw2C04JAADrs2AIQK4FCHD+BsgsAokARhzRHDYLTpNks2AIQK4Fk2QZ0QtBCQADZIhSs2AIQBnRHgESMikFC9ELQQkAAXsD4RI73YsUfwZPFk8mT/Zu9m32bPZr9mr2aQsA9mgALPwIoIYBALSvsggAprII8IurC5RwEBHYVrwIila8COoAAADrAAAA1wAAADRWvAhMF/wIWBf8CGQX/AhEAAAAUAAAAFwAAAAnAAAAKAAAACkAAAAAAAAA6AMAABAn","786195378d06baff":"CdYF52U0CgIJQgFCI2MIQywzAENDYDgwAiUEdSNkEEfwiwsACQAJAM3MzMw=","503c09b6b0baefb3":"4RkAJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRAsAQ2A=","160adecaa849e284":"hi+WL6Yvti/GL9Yv5i8iT/B/Q2hTaWNqc2uCUAggBImDUAggMIlnoAkAg1AIICuLk2RssAkACCAmiaNkZ7AJAAggIYmQOh+JsGABiByLs2EYcRBgAYgXi0DREmIoIhOJI2ADyBCLElMzYAPIDIs81Dw0MjQIixFVUjQFiSNmTDYiNgGLA6AJAADgNqAJADwyNuMA4AIiBHIQQ/uLMd7zZAh0C06zZfNkDHSzZQtOGHUt3gDkC04c5QNsAOQLThzlA22TZMNlN7DyVqNk02UzsPNWB+ACLwDgAR8k3gDkk2XDZgtOAOcA5KNl02YLTgDn8lACGPNQAxgB4BB/Jk/2bvZt9mz2a/Zq9mkLAPZoSCQQiUSEDogNi0NhIHESYhTTIDMHixWFBogEixFQCCABiQsAAeALAADgSVEG4hZgAiUEdRBC+otiJUIWQ2EQcRFgY2EQcQEh/+ALAGOBqEsQEdgAAAC4LLMIZiyzCJgmswhsJwuo","d82da843aae59533":"hi+WLyJPW9hAeFvREmmYKQ6JilAAOQuJAOADGAgYCRhW0ZNkC0Fb5YNkA2UEsJNmJk/2aQsA9miGL5Yvpi+2L8Yv1i/mLyJP8H9DaFNpY2qYKWuJlIQOiGiLk2EgcRJiSNMgM2KLEVAIIF+JFYUDaxVLW4sQ4ic7WImzbAJ8CEzDbVB9UH1A0RJiKCJOiSNgA8hLixJTM2ADyEeL02Q8NDI0Q4sRVVI0QIkjZkw2IjY8izwy02MJQwDgAiIEchBD+4sy3i7V82QLTgh0LNUYdfNkC04MdC7RAOQLQcNlA22ZUdNis2MWYAIiBHIQQ/qL8lRCIvNVURKSFJIVmIVIgViB/+BDgVOBs2ACcAIvAOABHyDRAOSTZdNmC0EA5/JQCBjzUAkYqhgBoAHgAOAQfyZP9m72bfZs9mv2avZpCwD2aAkAAQAAAAAAAADZACQAowIAAP8A//8BAAAAAQAAAAAAAADZADwApAIAAP8A//8BAAAAACz8CJhwEBE0VrwIRB/8CGwnC6ioSxARuCyzCGYsswiYJrMI","7010683be462baa0":"1i/mLyJPEk8CT/x/AdErQQkACQBcPr0I","ebd1070ec574dec1":"Ni9GL1YvZi92L4YvIk8R2IRTAXM0GBDTC0MJAAYvFi8O0RJjNhiCZDA0/+AAi4FQBRgL0RJgBxiEUwFzNBj2YfZgJk/2aPZn9mb2ZfZkCwD2YwkAACz8CIxpwggkjKsL8IurCw==","172e933902cb3738":"hi+WLyJPFNiEWZNgAcgMi4VQBi+HUAYvhFEQOQSL9mAJGPZgAaAIGAh/mhgL0QtBCQAGL4VR/+AAMQSJh1GJUAAxAYn/4AgYBdELQQkA9mAmT/ZpCwD2aAAs/AgQgbwIABb8CA==","2853d86b697a9dfa":"hi+WL6Yvti8iTxbRC0EJAANrFdgV0RJpmCkYiYxQADkCiQDgAhgDGBHRk2QLQV7lA2oP0ZNkC0Er5QNmg2SjZQzXDdELQQkACCAAiZwYC9EJAAkAs2AmT/Zr9mr2aQsA9mgJAEzDvQgALPwIlHAQETRWvAgAJvwIABz8CAAe/Ag=","7c188559c27b7ceb":"hi8iTwjRC0EJAANoB9EA4AIRAxEMEUBxAxEIEQkRChGDYCZPCwD2aD4sswgALPwI","e3f375bd0e18a505":"AQAAAAAAAACKAgQA6gAAAP8A//8BAAAAAQAAAAAAAACKAgQA6wAAAP8A//8B","4617c585a7472b06":"hi+WL6Yvti/GL9Yv5i8iTxJPAk/4f23RQHH/4AURBhFl2IhRGCFTicTgDGAeAigiTolB4AhALgkIcC4KmClHiQPgGEDMcI4LkVwF4RI8P4uTZKNlWdELQbNmFUA4i/9wA20DYQhBCEGcMRRxEWItYv9yA+M2MiuJKD0RTSiL02EEccIxJInTZAhECEScNBR0Q25L0QtBo2UDbONkQHRI0QtBo2XIMANtFU0Ri0jREj0OibNkyDQRRAqL0jQIiShEPrnTZQNuQdFAcQURAqAJAGKgAOA92EB4OtmdWhTgnAu8a5Fckl2UUZ1SoDIpi4JioDImibNi/3ID4zYyIYnGPR+L02PIMzPQAjMaiRlBGCEXiTNkGEQIRAhEEbkTZS7RBTEKAxoAKEMpQDsgCCAIibNi/3InABoDo2I4MqIoIRgCGIJcyCzDiR/RC0HzZPFRw20ITR7SIj26iYJiE2MoM9IztYmBUhNkKDTSNACL2DTSNK2JKETjuNNlFNJAcgYS42EIMQhBHWEfYRTSJwEaABPSLDDw4ixADNhAeAQYCH8GTxZPJk/2bvZt9mz2a/Zq9mkLAPZoCQDcRZQJTH2iCLbvoAjAUBAR/NnACAAs/AgAAAEAAAAIAAAAAQAyAAAAAIA=","163da0f1e1acc40a":"hi+WLyJPEk9f0QtBCQAGL2XYQHhd0QtBCQABiCkJiFGJUhghAYkoIgCLAOmDUZAxAolDsAkAkxiYKQGJoL4JAIhUhlUKsJNmiVSFVQawk2b2YBZPJk/2aQsA9mhIJCuJ1i/mLyJPQ25oJhqJ/+AANReJS9EXBRoNKU1K0Rw97IXQMAWJ02DsgQhw7oEDoAkA41AIIAyL42RA0QtBAeUHoAkA41AIIAOJ42Q80QtBAOUmT/ZuCwD2bQsACQCmL7Yvxi/WL+YvIk8x0RJsyCw0iSrdLNoq2wTu1GVcZS3RC0HDZAggJYkDZCrgTQEdYQXiJjEAiyNhsWM9YzYvFi9JUiYvpi/yURghEon/cRIf8VImZCEf8mM1ZTIvXWWYKQCJ81VIJO6JHNELQQkA6q8JABB/AnsQTs+PCnomT/Zu9m32bPZrCwD2agxTWU2hAqICogKiAsMBxAHFAcYBxwHIAckBygHLAcwByAHJAdAB0QHSAcgByQHNAc4BzwHIKvwIzCr8CNQq/AjoAr0I+NmvCJhwEBE0VrwIAKayCLSvsgjDAAAA2QAAAAAs/Ag=","5e4e42864642a517":"//////////8AAAAAAAAAAAAAAAD//////////wAAAAD/////","845677fae2e67916":"UABIAEEAUwBFACAATQBFAFQARQBSAAAAAA==","6922e93e3827642c":"pQ==","84014a74358fe2ac":"0q+y","371b074706e32cac":"Lfw=","060f2c4b6cd4c5e4":"gCn8","acf759afff056d54":"hi+WL6Yvti8iTxbRC0EJAANrFdgV0RJpmCkYiYxQADkCiQDgAhgDGBHRk2QLQV7lA2oP0ZNkC0Er5QNmg2SjZQzXDdEA4AkACCAAiZwYC9ELQQkAs2AmT/Zr9mr2aQsA9mgJAEzDvQgALPwIlHAQETRWvAgAJvwIABz8CAAe/Ag=","ca71ec9290d6ed48":"ZCL8","52b8fe18a1fed3bf":"ABj8","a2721044eff0d2f6":"Ghj8","620bfdaa346b088f":"fw==","582d807f9ed58432":"YO/8CA==","d77596e8499df246":"Q5FDkUORQ5Gl/KX8opCD4WP85875NZ+W","91aaac306bd43135":"Ik8i0QtBCQABiAOLIdFAcQHiLBEmTwsACQAiTx3RQHEcUAggAokA4AawDBEY0QtBCQAmTwsACQCGL5Yvpi8W0RNYiCgdiRXREmmYKRmJFNAeCqgqFYmTYpwyF3L84AkijDIiYA/TMDALiyFQkDAIi4NiFHKcMgF6JGAAKhBJ+48CevZq9mkLAPZoCQASKb0IVCq9CAAs/AjEBKoLYAd9CxjuAgBSR0I1","d5326732238d3e24":"4RkAJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRAsAQ2CWL6Yvti/GL9Yv5i8iT/R/Q25TbGNpc2r/7eguLonia7grK4kb0QtBs2QIICaJGdELQUjkCCAhiQEfAh8A4RIv42QDZRjWFNELQQHn8VLGEhfRFxIX0RgSs2TyVRDRC0EJAAggCoumL/NUD9XzZgR2k2cL0QtBCQADbQR/02AMfyZP9m72bfZs9mv2agsA9mkJAPI2lwgeeZoIUDyXCPA4lwiYQZcIBCwAAAJPAABQV1Y1RVhU","eede35a6260db6bf":"1i/mLyJPEk8CT/x/AdErQQkACQBcPr0IAdArQAkACQAQ2P0IEGBQiB6LEYRXiBuLEoRWiBiLE4Q1iBWLE2casAx3AogQixNnFbAQd2IwC4sTZxCwBHdA5EYwBYkcMANnbDdsNzY3A4sQQtuPAXEA4CZPCwAJAHRgDGB0ZVxlGEBbIHRlXGUYQFsgdGVcZRhACwBbIA==","bb010f4579136412":"hi+WLyJPFNiEWZNgAcgMi4VQBi+HUAYvhFEQOQSL9mAJGPZgAaAIGAh/mhgL0QtBCQAGL4VR/+AAMQSJh1GJUAAxAYn/4AgYBdELQQkA9mAmT/ZpCwD2aAAs/AgQgbwIABb8CIYvli+mL7Yvxi/WL+YvIk/0f0NoU2ljanNrM9ELQQkAA2wRTFWLom2ybuguUYnYLU+JLtEWPUyJAOACLwEfg2STZfNm82cOvAR38VRIJECJEUA6i/Jlrb7TZgggNYkDaNNk3DQXdPzgCSQIdCDRC0EJAAggKYkDaeNhk2IF4xZgAiIQQ/uPBHLTYxRgACIQQ/uPAXIY0QDl02OEYAxgAECEZABEXjAcAAAiEEP1jwFy02DcMBdw/OEZIJwwD9ESINEQkisL0QtB42TxVAnRC0EJAMNgDH8mT/Zu9m32bPZr9mr2aQsA9miAhpcIsB4EAOzGpQjC66UIYPD8CFJHQjU=","9bed08a38f1020b6":"hi+WL6Yvti8iTxbRC0EJAANrFdgV0RJpmCkYiYxQADkCiQDgAhgDGBHRk2QLQV7lA2oP0ZNkC0Er5QNmg2SjZQzXDdEA4AkACCAAiZwYC9EJAAkAs2AmT/Zr9mr2aQsA9mgJAEzDvQgALPwIlHAQETRWvAgAJvwIABz8CAAe/Ag=","87741faeb81ce6a9":"hi+WL6Yvti/GLyJPY2xDahR6XDpDaEDpgGBQiCeLgYRXiCSLgoRWiCGLg4Q1iB6Lg2dUsAx3AogZi4NnT7AEd0DhFjATiYNrDDuDZ0ewEHcDYQBBvDGmMQmJwjAMiQggBYkm0QwxwjEBiwegA2kQSdKPAXgsoADgKqCzYCDREmQA4AIhSCQCiR7QC0AJAMNkAEQd0AtACQAIIBmJA2gY0YIhg2KzYZNjFGAAIhRgIYAQQ/mPAnL+cRRkEGXDY5gzQ2AAIlNgIYAQQ/mPAnKDYCZP9mz2a/Zq9mkLAPZodGAMYHRlXGUYQFsgdGVcZRhAWyB0ZVxlGEALAFsg3AUAAADY/QjC66UI7MalCA==","9e7532da7f56183c":"hi+WL6Yvti8iTxbRC0EJAANrFdgV0RJpmCkYiYxQADkCiQDgAhgDGBHRk2QLQV7lA2oP0ZNkC0Er5QNmg2SjZQzXDdELQQkACCAAiZwYC9ELQQkAs2AmT/Zr9mr2aQsA9mgJAEzDvQgALPwIlHAQETRWvAgAJvwIABz8CAAe/Ag="},"flash":{"size":7995392,"stock":6893728,"all":6977184,"common":7095,"mods":{"extended_bpm":1,"phasemeter":982,"advanced_waveforms":5612,"beatjump":1068,"cuecolours":1877,"hotcuekeys":7707,"ledsaver":1363,"keynotation":2125,"usbautoload":967,"quicksearch":2083,"cuenames":868,"played":940,"endwarn":166,"wide_waveform":1419,"browseinfo":2046,"divhold":1367,"flacplay":11760,"exfatfs":33962,"credit":46}}}; +window.BUILDER_DATA = {"stockUpdSha256":"e96bca7d1ac983985992a8e5fa7813e1ebf04bef514e0c6cfd0a8375f667f7f9","stockAppSha256":"1ac3e30cde292865413950fe159663b3958e85939ed0a5d0122f796809a5f8ef","appSize":16519056,"dataBase":150744320,"upstream":{"extended_bpm":{"size":16576352,"ops":[["data",145914824,"45b88bcd5afea839"],["data",146586208,"c465a030b70c781e"],["data",146586876,"c465a030b70c781e"],["data",146618952,"c3967666e153796f"],["data",146619984,"7f0079b1f754ae7e"],["data",146620120,"a91a9b3491491b64"],["data",146829820,"f9e6d34295c320f0"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150739456,"786195378d06baff"],["data",150739521,"503c09b6b0baefb3"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"7010683be462baa0"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"172e933902cb3738"],["data",150742016,"2853d86b697a9dfa"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["assets",150744320,49760]]},"phasemeter":{"size":16576352,"ops":[["data",135069542,"845677fae2e67916"],["data",145914824,"45b88bcd5afea839"],["data",145941230,"6922e93e3827642c"],["data",145986008,"84014a74358fe2ac"],["data",145987228,"84014a74358fe2ac"],["data",145988312,"84014a74358fe2ac"],["data",146168552,"84014a74358fe2ac"],["data",146172320,"84014a74358fe2ac"],["data",146173504,"84014a74358fe2ac"],["data",146829820,"f9e6d34295c320f0"],["data",147236557,"371b074706e32cac"],["data",147246288,"060f2c4b6cd4c5e4"],["data",150411792,"845677fae2e67916"],["data",150427952,"845677fae2e67916"],["data",150446592,"845677fae2e67916"],["data",150464904,"845677fae2e67916"],["data",150483144,"845677fae2e67916"],["data",150501528,"845677fae2e67916"],["data",150519852,"845677fae2e67916"],["data",150538228,"845677fae2e67916"],["data",150556534,"845677fae2e67916"],["data",150572646,"845677fae2e67916"],["data",150587026,"845677fae2e67916"],["data",150601380,"845677fae2e67916"],["data",150619274,"845677fae2e67916"],["data",150637628,"845677fae2e67916"],["data",150655862,"845677fae2e67916"],["data",150673666,"845677fae2e67916"],["data",150692276,"845677fae2e67916"],["data",150709976,"845677fae2e67916"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150739456,"786195378d06baff"],["data",150739521,"503c09b6b0baefb3"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"7010683be462baa0"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"172e933902cb3738"],["data",150742016,"acf759afff056d54"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["assets",150744320,49760]]},"advanced_waveforms":{"size":16636928,"ops":[["data",144311836,"ca71ec9290d6ed48"],["data",146565168,"52b8fe18a1fed3bf"],["data",146565756,"a2721044eff0d2f6"],["data",146603378,"620bfdaa346b088f"],["data",146603856,"582d807f9ed58432"],["data",147243844,"d77596e8499df246"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150738944,"91aaac306bd43135"],["data",150739456,"786195378d06baff"],["data",150739521,"d5326732238d3e24"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"eede35a6260db6bf"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"bb010f4579136412"],["data",150742016,"9bed08a38f1020b6"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["data",150853648,"87741faeb81ce6a9"],["assets",150744320,50528]]},"extended_bpm,phasemeter":{"size":16576352,"ops":[["data",135069542,"845677fae2e67916"],["data",145914824,"45b88bcd5afea839"],["data",145941230,"6922e93e3827642c"],["data",145986008,"84014a74358fe2ac"],["data",145987228,"84014a74358fe2ac"],["data",145988312,"84014a74358fe2ac"],["data",146168552,"84014a74358fe2ac"],["data",146172320,"84014a74358fe2ac"],["data",146173504,"84014a74358fe2ac"],["data",146586208,"c465a030b70c781e"],["data",146586876,"c465a030b70c781e"],["data",146618952,"c3967666e153796f"],["data",146619984,"7f0079b1f754ae7e"],["data",146620120,"a91a9b3491491b64"],["data",146829820,"f9e6d34295c320f0"],["data",147236557,"371b074706e32cac"],["data",147246288,"060f2c4b6cd4c5e4"],["data",150411792,"845677fae2e67916"],["data",150427952,"845677fae2e67916"],["data",150446592,"845677fae2e67916"],["data",150464904,"845677fae2e67916"],["data",150483144,"845677fae2e67916"],["data",150501528,"845677fae2e67916"],["data",150519852,"845677fae2e67916"],["data",150538228,"845677fae2e67916"],["data",150556534,"845677fae2e67916"],["data",150572646,"845677fae2e67916"],["data",150587026,"845677fae2e67916"],["data",150601380,"845677fae2e67916"],["data",150619274,"845677fae2e67916"],["data",150637628,"845677fae2e67916"],["data",150655862,"845677fae2e67916"],["data",150673666,"845677fae2e67916"],["data",150692276,"845677fae2e67916"],["data",150709976,"845677fae2e67916"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150739456,"786195378d06baff"],["data",150739521,"503c09b6b0baefb3"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"7010683be462baa0"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"172e933902cb3738"],["data",150742016,"9e7532da7f56183c"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["assets",150744320,49760]]},"extended_bpm,advanced_waveforms":{"size":16636928,"ops":[["data",144311836,"ca71ec9290d6ed48"],["data",145914824,"45b88bcd5afea839"],["data",146565168,"52b8fe18a1fed3bf"],["data",146565756,"a2721044eff0d2f6"],["data",146586208,"c465a030b70c781e"],["data",146586876,"c465a030b70c781e"],["data",146603378,"620bfdaa346b088f"],["data",146603856,"582d807f9ed58432"],["data",146618952,"c3967666e153796f"],["data",146619984,"7f0079b1f754ae7e"],["data",146620120,"a91a9b3491491b64"],["data",146829820,"f9e6d34295c320f0"],["data",147243844,"d77596e8499df246"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150738944,"91aaac306bd43135"],["data",150739456,"786195378d06baff"],["data",150739521,"d5326732238d3e24"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"eede35a6260db6bf"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"bb010f4579136412"],["data",150742016,"2853d86b697a9dfa"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["data",150853648,"87741faeb81ce6a9"],["assets",150744320,50528]]},"phasemeter,advanced_waveforms":{"size":16636928,"ops":[["data",135069542,"845677fae2e67916"],["data",144311836,"ca71ec9290d6ed48"],["data",145914824,"45b88bcd5afea839"],["data",145941230,"6922e93e3827642c"],["data",145986008,"84014a74358fe2ac"],["data",145987228,"84014a74358fe2ac"],["data",145988312,"84014a74358fe2ac"],["data",146168552,"84014a74358fe2ac"],["data",146172320,"84014a74358fe2ac"],["data",146173504,"84014a74358fe2ac"],["data",146565168,"52b8fe18a1fed3bf"],["data",146565756,"a2721044eff0d2f6"],["data",146603378,"620bfdaa346b088f"],["data",146603856,"582d807f9ed58432"],["data",146829820,"f9e6d34295c320f0"],["data",147236557,"371b074706e32cac"],["data",147243844,"d77596e8499df246"],["data",147246288,"060f2c4b6cd4c5e4"],["data",150411792,"845677fae2e67916"],["data",150427952,"845677fae2e67916"],["data",150446592,"845677fae2e67916"],["data",150464904,"845677fae2e67916"],["data",150483144,"845677fae2e67916"],["data",150501528,"845677fae2e67916"],["data",150519852,"845677fae2e67916"],["data",150538228,"845677fae2e67916"],["data",150556534,"845677fae2e67916"],["data",150572646,"845677fae2e67916"],["data",150587026,"845677fae2e67916"],["data",150601380,"845677fae2e67916"],["data",150619274,"845677fae2e67916"],["data",150637628,"845677fae2e67916"],["data",150655862,"845677fae2e67916"],["data",150673666,"845677fae2e67916"],["data",150692276,"845677fae2e67916"],["data",150709976,"845677fae2e67916"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150738944,"91aaac306bd43135"],["data",150739456,"786195378d06baff"],["data",150739521,"d5326732238d3e24"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"eede35a6260db6bf"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"bb010f4579136412"],["data",150742016,"acf759afff056d54"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["data",150853648,"87741faeb81ce6a9"],["assets",150744320,50528]]},"extended_bpm,phasemeter,advanced_waveforms":{"size":16636928,"ops":[["data",135069542,"845677fae2e67916"],["data",144311836,"ca71ec9290d6ed48"],["data",145914824,"45b88bcd5afea839"],["data",145941230,"6922e93e3827642c"],["data",145986008,"84014a74358fe2ac"],["data",145987228,"84014a74358fe2ac"],["data",145988312,"84014a74358fe2ac"],["data",146168552,"84014a74358fe2ac"],["data",146172320,"84014a74358fe2ac"],["data",146173504,"84014a74358fe2ac"],["data",146565168,"52b8fe18a1fed3bf"],["data",146565756,"a2721044eff0d2f6"],["data",146586208,"c465a030b70c781e"],["data",146586876,"c465a030b70c781e"],["data",146603378,"620bfdaa346b088f"],["data",146603856,"582d807f9ed58432"],["data",146618952,"c3967666e153796f"],["data",146619984,"7f0079b1f754ae7e"],["data",146620120,"a91a9b3491491b64"],["data",146829820,"f9e6d34295c320f0"],["data",147236557,"371b074706e32cac"],["data",147243844,"d77596e8499df246"],["data",147246288,"060f2c4b6cd4c5e4"],["data",150411792,"845677fae2e67916"],["data",150427952,"845677fae2e67916"],["data",150446592,"845677fae2e67916"],["data",150464904,"845677fae2e67916"],["data",150483144,"845677fae2e67916"],["data",150501528,"845677fae2e67916"],["data",150519852,"845677fae2e67916"],["data",150538228,"845677fae2e67916"],["data",150556534,"845677fae2e67916"],["data",150572646,"845677fae2e67916"],["data",150587026,"845677fae2e67916"],["data",150601380,"845677fae2e67916"],["data",150619274,"845677fae2e67916"],["data",150637628,"845677fae2e67916"],["data",150655862,"845677fae2e67916"],["data",150673666,"845677fae2e67916"],["data",150692276,"845677fae2e67916"],["data",150709976,"845677fae2e67916"],["data",150736896,"6d11cfe939a0630a"],["data",150737408,"a4d77ab57ab896dd"],["data",150737920,"906ea135b6ba2cef"],["data",150738432,"d6db78bde1edbcae"],["data",150738944,"91aaac306bd43135"],["data",150739456,"786195378d06baff"],["data",150739521,"d5326732238d3e24"],["data",150739968,"160adecaa849e284"],["data",150740480,"d82da843aae59533"],["data",150740992,"eede35a6260db6bf"],["data",150741248,"ebd1070ec574dec1"],["data",150741504,"bb010f4579136412"],["data",150742016,"9e7532da7f56183c"],["data",150742272,"7c188559c27b7ceb"],["data",150742528,"e3f375bd0e18a505"],["data",150742784,"4617c585a7472b06"],["data",150743424,"163da0f1e1acc40a"],["data",150744064,"5e4e42864642a517"],["data",150853648,"87741faeb81ce6a9"],["assets",150744320,50528]]}},"expect":{"extended_bpm":"1150cc0099d890fb4b9e09cf19f03464106ffd5fd04b1fa940d5af0b41008c4a","phasemeter":"dca533375e39fed109c5b35aef80bcc036ed4500ee2e67f8f3ea3bb0309cdedb","advanced_waveforms":"d91dbf251c1c92ff06b41c28582e78fe2611d7e419b6cf0e9bdf7fadf8eb723d","extended_bpm,phasemeter":"5c663e5fdb53c791a75ee45de1a0875eb83fd247534a916403427cb35e578f14","extended_bpm,advanced_waveforms":"9b74c6fe5760b86c81217dc536ae98c2bf2f23f7552818ff1519f06862265b33","phasemeter,advanced_waveforms":"3343e8ee244a2afee30f8ca950019be6f99d3d4ccba702cff50913b342a02c1f","extended_bpm,phasemeter,advanced_waveforms":"cb991e829faf76cd8a64fbdc6a52852aac4daac2aaedd2f32a59db3bf222007e"},"chunks":{"45b88bcd5afea839":"ACX8","c465a030b70c781e":"ACL8","c3967666e153796f":"ACH8","7f0079b1f754ae7e":"AdErQQkACQAAEPwI","a91a9b3491491b64":"AdYrRgkACQAAEvwI","f9e6d34295c320f0":"ACT8","6d11cfe939a0630a":"hi+WLyJPCdj/4AEYCNELQQkAA2kCKAfREmEYIQGJ/+ABGJNgJk/2aQsA9mgALPwIACD8CKDSTQo=","a4d77ab57ab896dd":"Bi8WLyYvNi9GL1YvZi92LyJPEk8CTwNl42QM0QtBCQAL0QERBk8WTyZP9mf2ZvZl9mT2Y/Zi9mH2YGoFJ+YYRgTREHYE1wXSK0IJAAAU/AgALPwIhIurC1DDAADkPr0I","906ea135b6ba2cef":"Ek8CTw3REjQTiQ3REzUQiwzRFzUNiQzRHDVHBRoAC9EcMAvSJTAKAPPhHUAJ0RIwAIv/4AZPCwAWTwkA//8AAPDY////fwAAECcAAIgTAABZF7fRoIYB","d6db78bde1edbcae":"hi+WL6Yvti/GL9Yv5i8iTxJPAk/sfz7YglAIIAKJg1AIIAGLaKAJAIhbOtESOweJiVADagGIDYkCiAuJA4gJiTXRglQLQQDlM9GDVAtBAOVSoAkAM9ESabNk82XQsQkAo2ADiCkMgl2DVC/eNNrILAOJglSDXS3eMton0QtBAOXxVQBFKtEcNcw102Qj0QtBCQDTZAHlINELQQkAk2Q35fJmyCwDiSXlAEYi0Rw2C04JAADrs2AIQK4FCHD+BsgsAokARhzRHDYLTpNks2AIQK4Fk2QZ0QtBCQADZIhSs2AIQBnRHgESMikFC9ELQQkAAXsD4RI73YsUfwZPFk8mT/Zu9m32bPZr9mr2aQsA9mgALPwIoIYBALSvsggAprII8IurC5RwEBHYVrwIila8COoAAADrAAAA1wAAADRWvAhMF/wIWBf8CGQX/AhEAAAAUAAAAFwAAAAnAAAAKAAAACkAAAAAAAAA6AMAABAn","786195378d06baff":"CdYF52U0CgIJQgFCI2MIQywzAENDYDgwAiUEdSNkEEfwiwsACQAJAM3MzMw=","503c09b6b0baefb3":"4RkAJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRAsAQ2A=","160adecaa849e284":"hi+WL6Yvti/GL9Yv5i8iT/B/Q2hTaWNqc2uCUAggBImDUAggMIlnoAkAg1AIICuLk2RssAkACCAmiaNkZ7AJAAggIYmQOh+JsGABiByLs2EYcRBgAYgXi0DREmIoIhOJI2ADyBCLElMzYAPIDIs81Dw0MjQIixFVUjQFiSNmTDYiNgGLA6AJAADgNqAJADwyNuMA4AIiBHIQQ/uLMd7zZAh0C06zZfNkDHSzZQtOGHUt3gDkC04c5QNsAOQLThzlA22TZMNlN7DyVqNk02UzsPNWB+ACLwDgAR8k3gDkk2XDZgtOAOcA5KNl02YLTgDn8lACGPNQAxgB4BB/Jk/2bvZt9mz2a/Zq9mkLAPZoSCQQiUSEDogNi0NhIHESYhTTIDMHixWFBogEixFQCCABiQsAAeALAADgSVEG4hZgAiUEdRBC+otiJUIWQ2EQcRFgY2EQcQEh/+ALAGOBqEsQEdgAAAC4LLMIZiyzCJgmswhsJwuo","d82da843aae59533":"hi+WLyJPW9hAeFvREmmYKQ6JilAAOQuJAOADGAgYCRhW0ZNkC0Fb5YNkA2UEsJNmJk/2aQsA9miGL5Yvpi+2L8Yv1i/mLyJP8H9DaFNpY2qYKWuJlIQOiGiLk2EgcRJiSNMgM2KLEVAIIF+JFYUDaxVLW4sQ4ic7WImzbAJ8CEzDbVB9UH1A0RJiKCJOiSNgA8hLixJTM2ADyEeL02Q8NDI0Q4sRVVI0QIkjZkw2IjY8izwy02MJQwDgAiIEchBD+4sy3i7V82QLTgh0LNUYdfNkC04MdC7RAOQLQcNlA22ZUdNis2MWYAIiBHIQQ/qL8lRCIvNVURKSFJIVmIVIgViB/+BDgVOBs2ACcAIvAOABHyDRAOSTZdNmC0EA5/JQCBjzUAkYqhgBoAHgAOAQfyZP9m72bfZs9mv2avZpCwD2aAkAAQAAAAAAAADZACQAowIAAP8A//8BAAAAAQAAAAAAAADZADwApAIAAP8A//8BAAAAACz8CJhwEBE0VrwIRB/8CGwnC6ioSxARuCyzCGYsswiYJrMI","7010683be462baa0":"1i/mLyJPEk8CT/x/AdErQQkACQBcPr0I","ebd1070ec574dec1":"Ni9GL1YvZi92L4YvIk8R2IRTAXM0GBDTC0MJAAYvFi8O0RJjNhiCZDA0/+AAi4FQBRgL0RJgBxiEUwFzNBj2YfZgJk/2aPZn9mb2ZfZkCwD2YwkAACz8CIxpwggkjKsL8IurCw==","172e933902cb3738":"hi+WLyJPFNiEWZNgAcgMi4VQBi+HUAYvhFEQOQSL9mAJGPZgAaAIGAh/mhgL0QtBCQAGL4VR/+AAMQSJh1GJUAAxAYn/4AgYBdELQQkA9mAmT/ZpCwD2aAAs/AgQgbwIABb8CA==","2853d86b697a9dfa":"hi+WL6Yvti8iTxbRC0EJAANrFdgV0RJpmCkYiYxQADkCiQDgAhgDGBHRk2QLQV7lA2oP0ZNkC0Er5QNmg2SjZQzXDdELQQkACCAAiZwYC9EJAAkAs2AmT/Zr9mr2aQsA9mgJAEzDvQgALPwIlHAQETRWvAgAJvwIABz8CAAe/Ag=","7c188559c27b7ceb":"hi8iTwjRC0EJAANoB9EA4AIRAxEMEUBxAxEIEQkRChGDYCZPCwD2aD4sswgALPwI","e3f375bd0e18a505":"AQAAAAAAAACKAgQA6gAAAP8A//8BAAAAAQAAAAAAAACKAgQA6wAAAP8A//8B","4617c585a7472b06":"hi+WL6Yvti/GL9Yv5i8iTxJPAk/4f23RQHH/4AURBhFl2IhRGCFTicTgDGAeAigiTolB4AhALgkIcC4KmClHiQPgGEDMcI4LkVwF4RI8P4uTZKNlWdELQbNmFUA4i/9wA20DYQhBCEGcMRRxEWItYv9yA+M2MiuJKD0RTSiL02EEccIxJInTZAhECEScNBR0Q25L0QtBo2UDbONkQHRI0QtBo2XIMANtFU0Ri0jREj0OibNkyDQRRAqL0jQIiShEPrnTZQNuQdFAcQURAqAJAGKgAOA92EB4OtmdWhTgnAu8a5Fckl2UUZ1SoDIpi4JioDImibNi/3ID4zYyIYnGPR+L02PIMzPQAjMaiRlBGCEXiTNkGEQIRAhEEbkTZS7RBTEKAxoAKEMpQDsgCCAIibNi/3InABoDo2I4MqIoIRgCGIJcyCzDiR/RC0HzZPFRw20ITR7SIj26iYJiE2MoM9IztYmBUhNkKDTSNACL2DTSNK2JKETjuNNlFNJAcgYS42EIMQhBHWEfYRTSJwEaABPSLDDw4ixADNhAeAQYCH8GTxZPJk/2bvZt9mz2a/Zq9mkLAPZoCQDcRZQJTH2iCLbvoAjAUBAR/NnACAAs/AgAAAEAAAAIAAAAAQAyAAAAAIA=","163da0f1e1acc40a":"hi+WLyJPEk9f0QtBCQAGL2XYQHhd0QtBCQABiCkJiFGJUhghAYkoIgCLAOmDUZAxAolDsAkAkxiYKQGJoL4JAIhUhlUKsJNmiVSFVQawk2b2YBZPJk/2aQsA9mhIJCuJ1i/mLyJPQ25oJhqJ/+AANReJS9EXBRoNKU1K0Rw97IXQMAWJ02DsgQhw7oEDoAkA41AIIAyL42RA0QtBAeUHoAkA41AIIAOJ42Q80QtBAOUmT/ZuCwD2bQsACQCmL7Yvxi/WL+YvIk8x0RJsyCw0iSrdLNoq2wTu1GVcZS3RC0HDZAggJYkDZCrgTQEdYQXiJjEAiyNhsWM9YzYvFi9JUiYvpi/yURghEon/cRIf8VImZCEf8mM1ZTIvXWWYKQCJ81VIJO6JHNELQQkA6q8JABB/AnsQTs+PCnomT/Zu9m32bPZrCwD2agxTWU2hAqICogKiAsMBxAHFAcYBxwHIAckBygHLAcwByAHJAdAB0QHSAcgByQHNAc4BzwHIKvwIzCr8CNQq/AjoAr0I+NmvCJhwEBE0VrwIAKayCLSvsgjDAAAA2QAAAAAs/Ag=","5e4e42864642a517":"//////////8AAAAAAAAAAAAAAAD//////////wAAAAD/////","845677fae2e67916":"UABIAEEAUwBFACAATQBFAFQARQBSAAAAAA==","6922e93e3827642c":"pQ==","84014a74358fe2ac":"0q+y","371b074706e32cac":"Lfw=","060f2c4b6cd4c5e4":"gCn8","acf759afff056d54":"hi+WL6Yvti8iTxbRC0EJAANrFdgV0RJpmCkYiYxQADkCiQDgAhgDGBHRk2QLQV7lA2oP0ZNkC0Er5QNmg2SjZQzXDdEA4AkACCAAiZwYC9ELQQkAs2AmT/Zr9mr2aQsA9mgJAEzDvQgALPwIlHAQETRWvAgAJvwIABz8CAAe/Ag=","ca71ec9290d6ed48":"ZCL8","52b8fe18a1fed3bf":"ABj8","a2721044eff0d2f6":"Ghj8","620bfdaa346b088f":"fw==","582d807f9ed58432":"YO/8CA==","d77596e8499df246":"Q5FDkUORQ5Gl/KX8opCD4WP85875NZ+W","91aaac306bd43135":"Ik8i0QtBCQABiAOLIdFAcQHiLBEmTwsACQAiTx3RQHEcUAggAokA4AawDBEY0QtBCQAmTwsACQCGL5Yvpi8W0RNYiCgdiRXREmmYKRmJFNAeCqgqFYmTYpwyF3L84AkijDIiYA/TMDALiyFQkDAIi4NiFHKcMgF6JGAAKhBJ+48CevZq9mkLAPZoCQASKb0IVCq9CAAs/AjEBKoLYAd9CxjuAgBSR0I1","d5326732238d3e24":"4RkAJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRFQxJERUMSREVDEkRAsAQ2CWL6Yvti/GL9Yv5i8iT/R/Q25TbGNpc2r/7eguLonia7grK4kb0QtBs2QIICaJGdELQUjkCCAhiQEfAh8A4RIv42QDZRjWFNELQQHn8VLGEhfRFxIX0RgSs2TyVRDRC0EJAAggCoumL/NUD9XzZgR2k2cL0QtBCQADbQR/02AMfyZP9m72bfZs9mv2agsA9mkJAPI2lwgeeZoIUDyXCPA4lwiYQZcIBCwAAAJPAABQV1Y1RVhU","eede35a6260db6bf":"1i/mLyJPEk8CT/x/AdErQQkACQBcPr0IAdArQAkACQAQ2P0IEGBQiB6LEYRXiBuLEoRWiBiLE4Q1iBWLE2casAx3AogQixNnFbAQd2IwC4sTZxCwBHdA5EYwBYkcMANnbDdsNzY3A4sQQtuPAXEA4CZPCwAJAHRgDGB0ZVxlGEBbIHRlXGUYQFsgdGVcZRhACwBbIA==","bb010f4579136412":"hi+WLyJPFNiEWZNgAcgMi4VQBi+HUAYvhFEQOQSL9mAJGPZgAaAIGAh/mhgL0QtBCQAGL4VR/+AAMQSJh1GJUAAxAYn/4AgYBdELQQkA9mAmT/ZpCwD2aAAs/AgQgbwIABb8CIYvli+mL7Yvxi/WL+YvIk/0f0NoU2ljanNrM9ELQQkAA2wRTFWLom2ybuguUYnYLU+JLtEWPUyJAOACLwEfg2STZfNm82cOvAR38VRIJECJEUA6i/Jlrb7TZgggNYkDaNNk3DQXdPzgCSQIdCDRC0EJAAggKYkDaeNhk2IF4xZgAiIQQ/uPBHLTYxRgACIQQ/uPAXIY0QDl02OEYAxgAECEZABEXjAcAAAiEEP1jwFy02DcMBdw/OEZIJwwD9ESINEQkisL0QtB42TxVAnRC0EJAMNgDH8mT/Zu9m32bPZr9mr2aQsA9miAhpcIsB4EAOzGpQjC66UIYPD8CFJHQjU=","9bed08a38f1020b6":"hi+WL6Yvti8iTxbRC0EJAANrFdgV0RJpmCkYiYxQADkCiQDgAhgDGBHRk2QLQV7lA2oP0ZNkC0Er5QNmg2SjZQzXDdEA4AkACCAAiZwYC9EJAAkAs2AmT/Zr9mr2aQsA9mgJAEzDvQgALPwIlHAQETRWvAgAJvwIABz8CAAe/Ag=","87741faeb81ce6a9":"hi+WL6Yvti/GLyJPY2xDahR6XDpDaEDpgGBQiCeLgYRXiCSLgoRWiCGLg4Q1iB6Lg2dUsAx3AogZi4NnT7AEd0DhFjATiYNrDDuDZ0ewEHcDYQBBvDGmMQmJwjAMiQggBYkm0QwxwjEBiwegA2kQSdKPAXgsoADgKqCzYCDREmQA4AIhSCQCiR7QC0AJAMNkAEQd0AtACQAIIBmJA2gY0YIhg2KzYZNjFGAAIhRgIYAQQ/mPAnL+cRRkEGXDY5gzQ2AAIlNgIYAQQ/mPAnKDYCZP9mz2a/Zq9mkLAPZodGAMYHRlXGUYQFsgdGVcZRhAWyB0ZVxlGEALAFsg3AUAAADY/QjC66UI7MalCA==","9e7532da7f56183c":"hi+WL6Yvti8iTxbRC0EJAANrFdgV0RJpmCkYiYxQADkCiQDgAhgDGBHRk2QLQV7lA2oP0ZNkC0Er5QNmg2SjZQzXDdELQQkACCAAiZwYC9ELQQkAs2AmT/Zr9mr2aQsA9mgJAEzDvQgALPwIlHAQETRWvAgAJvwIABz8CAAe/Ag="},"flash":{"size":7995392,"stock":6893728,"all":6977344,"common":7095,"mods":{"extended_bpm":1,"phasemeter":1198,"advanced_waveforms":5608,"beatjump":1067,"cuecolours":1875,"hotcuekeys":7701,"ledsaver":1362,"keynotation":2124,"usbautoload":966,"quicksearch":2082,"cuenames":867,"played":940,"endwarn":166,"wide_waveform":1418,"browseinfo":2044,"divhold":1375,"flacplay":11750,"exfatfs":33933,"credit":46}}}; diff --git a/builder/py/bundle.json b/builder/py/bundle.json index 55b5d39..213e1fb 100644 --- a/builder/py/bundle.json +++ b/builder/py/bundle.json @@ -1 +1 @@ -{"mods/patch_cdj900nxs.py":"#!/usr/bin/env python3\n# SPDX-License-Identifier: GPL-2.0-or-later\n\"\"\"Apply arnoldasr's CDJ-900NXS 1.31 mods to the unpacked MAIN image.\n\n usage: patch_cdj900nxs.py [,...]\n patch_cdj900nxs.py --list\n\nThe mods come from https://github.com/arnoldasr/cdj900nxs, read as data from a\ncheckout of it (CDJ900NXS_MODS_SRC, default mods/cdj900nxs/upstream, which is\nnot committed: that repository carries no licence). Nothing of its Python is\nimported; what its build_firmware.py does is redone here:\n\n extended_bpm the BPM with hundredths: the stock tenths moved into a new\n small digit above, the lower one showing hundredths.\n phasemeter the two-line phase meter (orange master, blue this deck, a\n marker each) in place of the four boxes, chosen in UTILITY >\n PHASE METER (SLIP FLASHING relabelled; mods/phase-meter-\n utility.cdjmod.json).\n advanced_waveforms (was rgb_waveform; based on arnoldasr's, updated and\n maintained by us) the big waveform in rekordbox's RGB colours\n (1.0.1: also when its colour detail is a little short,\n cdj900nxs/wavefix.py), and the overview's colour table as a red-to-white\n gradient (mods/waveform-colour.cdjmod.json); with our\n UTILITY > WAVEFORM: BLUE / RGB / 3BAND (cdj900nxs/wavemodes.py,\n left out with public=True).\n\n The three are arnoldasr's code mod (patches/mods.json): hooks\n in the application redirected to SH-4 code appended after it\n (0x08FC1000), plus an asset blob at 0x08FC2D00 generated from\n the stock image (the resource table extended by four phase-meter\n images, then the RGB waveform palette and LUT). Upstream tested\n it as one build, and as one without the RGB waveform\n (patches/bpm-phase-meter.json); one of those two is built and\n checked against its hash first, then the hooks of a feature not\n chosen get their original bytes back. Their shared startup hook\n (0x08C071FC) installs the BPM digits and the phase markers: the\n call of the one not chosen is taken out there.\n beatjump ours, not arnoldasr's (cdj900nxs/beatjump.py): TRACK SEARCH\n jumps 1/2/4/8 beats along the grid, chosen in UTILITY > BEAT JUMP,\n made at once in the DSP's decoded audio (cdj900nxs/dspjump.py, a\n patch of the audio DSP's code),\n which replaces SCREEN SAVER. hotcuekeys' engine makes the jumps,\n so it needs hotcuekeys and cuecolours. Needs no upstream checkout.\n cuecolours ours (cdj900nxs/cuecolours.py): memory cues drawn in their\n rekordbox colour on the overview and the detail waveform, the\n rekordbox hot cues shown as lettered boxes.\n Needs no upstream checkout.\n hotcuekeys ours (cdj900nxs/hotcuekeys.py): UTILITY > HOT CUE KEYS (a new,\n 18th item); with it ON, QUANTIZE briefly pressed switches a hot\n cue key mode shown in a HOT KEYS box, held it is QUANTIZE. In\n the mode the top three BEAT DIVIDE keys play hot cues A-C (held: a\n gate), set one (empty key held while paused) or delete one\n (DELETE held). The hot cues come from cuecolours.\n ledsaver ours (cdj900nxs/ledsaver.py): UTILITY > LED ANIMATION (one more\n item, after the others); with it ON, while the screen saver dims\n the display the button LEDs and the jog's rings play a loop.\n keynotation ours (cdj900nxs/keynotation.py): UTILITY > KEY NOTATION (one\n more item): every track's key in Camelot, Open Key or classic\n notation, whatever rekordbox exported.\n usbautoload ours (cdj900nxs/usbautoload.py): UTILITY > USB AUTO LOAD (one\n more item): a stick's MY SETTINGS are loaded when the player finds\n them, without waiting for MENU.\n quicksearch ours (cdj900nxs/quicksearch.py): BROWSE held opens SEARCH,\n BROWSE twice the list the playing track came from; the screen\n holds its frame while the player walks there, so no step shows.\n browseinfo ours (cdj900nxs/browseinfo.py): every track row in BROWSE shows\n its BPM and key on the right, read from the stick's rekordbox\n export (the key in KEY NOTATION's notation and colour).\n (phasemeter also gets ours from cdj900nxs/phasereverse.py:\n UTILITY > PHASE METER STOCK / V1 / V1 REVERSE / V2, and the beat countdown\n moved clear of the line meter; `phasereverse` is an old name for it.)\n wide_waveform ours (cdj900nxs/widewave.py): the big waveform runs on to the\n right edge (624 columns, the extra ones ahead of the position); the\n ZOOM/GRID wheel gives way to a small grey ZOOM / GRID box.\n divhold ours (cdj900nxs/divhold.py): UTILITY > DIVIDE HOLD (one more\n item); with it ON a BEAT DIVIDE key held at least 0.5 s keeps its\n divide only until let go (SLIP's slip loop stays as it is).\n flacplay ours (cdj900nxs/flacplay.py, C in cdj900nxs/c built into\n flacplay_bin.py): .flac files play as on the newer players, as the\n player's own WAV (decoded on the fly behind its stdio; 88.2-192 kHz\n brought to 44.1/48 kHz).\n exfatfs ours (cdj900nxs/exfatfs.py, C in cdj900nxs/c built into\n exfatfs_bin.py): exFAT sticks (MBR, GPT or none) work, read and\n written (what the player writes to a stick), shown to the player's\n FAT32 driver as a FAT32 volume made up at the sector level.\n credit ours (cdj900nxs/credit.py): the boot screen says \"Pionaarr Mods\n 1.0\" where it said \"Ver 1.31\".\n\nEvery patch is applied only where the image holds the expected original\nbytes, and arnoldasr's code is first built as one of the builds he tested\nand checked against its hash.\n\nOur lzss_decode.py runs 54 bytes past the end of the packed stream, so\nmain_unpacked.bin is the 1.31 application plus a tail the firmware never\nreads; the application is cut back to its own length first.\n\"\"\"\nimport hashlib\nimport json\nimport os\nimport struct\nimport sys\n\nHERE = os.path.dirname(os.path.abspath(__file__))\nsys.path.insert(0, os.path.join(HERE, 'cdj900nxs'))\nimport beatjump # noqa: E402\nimport credit # noqa: E402\nimport dspjump # noqa: E402\nimport cuecolours # noqa: E402\nimport hotcuekeys # noqa: E402\nimport keynotation # noqa: E402\nimport ledsaver # noqa: E402\nimport usbautoload # noqa: E402\nimport quicksearch # noqa: E402\nimport phasereverse # noqa: E402\nimport wavemodes # noqa: E402\nimport wavefix # noqa: E402\nimport cuenames # noqa: E402\nimport endwarn # noqa: E402\nimport played # noqa: E402\nimport widewave # noqa: E402\nimport divhold # noqa: E402\nimport browseinfo # noqa: E402\nimport flacplay # noqa: E402\nimport exfatfs # noqa: E402\n\nBASE = 0x08000000\nAPP_SIZE = 16519056\nAPP_SHA256 = '1ac3e30cde292865413950fe159663b3958e85939ed0a5d0122f796809a5f8ef'\n\nMODS = {\n 'extended_bpm': 'BPM with hundredths: tenths as a small digit above (arnoldasr)',\n 'phasemeter': 'two-line phase meter, UTILITY > PHASE METER (SLIP FLASHING) chooses it (arnoldasr); '\n 'STOCK / V1 / V1 REVERSE / V2 (rulers as on the newer players) and the beat countdown '\n 'moved clear of it (ours: cdj900nxs/phasereverse.py)',\n 'advanced_waveforms': 'big waveform in RGB colours, overview as a red-to-white gradient (arnoldasr); '\n 'UTILITY > WAVEFORM: BLUE / RGB / 3BAND (ours: cdj900nxs/wavemodes.py)',\n 'beatjump': 'TRACK SEARCH jumps 1/2/4/8 beats, UTILITY > BEAT JUMP (ours: cdj900nxs/beatjump.py)',\n 'cuecolours': 'memory cues in their rekordbox colours, hot cues shown (ours: cdj900nxs/cuecolours.py)',\n 'hotcuekeys': 'hot cues A-C on the BEAT DIVIDE keys: play, gate, set, delete; UTILITY > HOT CUE KEYS, '\n 'QUANTIZE short = hot key mode (ours: cdj900nxs/hotcuekeys.py)',\n 'ledsaver': 'the button and jog LEDs play an animation while the screen saver dims the display; '\n 'UTILITY > LED ANIMATION (ours: cdj900nxs/ledsaver.py)',\n 'keynotation': 'every key in one notation (Camelot / Open Key / classic), UTILITY > KEY NOTATION '\n '(ours: cdj900nxs/keynotation.py)',\n 'usbautoload': 'MY SETTINGS on a USB stick loaded at once, UTILITY > USB AUTO LOAD '\n '(ours: cdj900nxs/usbautoload.py)',\n 'quicksearch': 'BROWSE held: SEARCH; BROWSE twice: the playing track in its list '\n '(ours: cdj900nxs/quicksearch.py)',\n 'cuenames': 'the rekordbox comment of the next cue (\"Drop\") in the title bar, in its colour '\n '(ours: cdj900nxs/cuenames.py, needs cuecolours)',\n 'endwarn': 'the playing-address bar blinks red in the last 30 seconds (ours: cdj900nxs/endwarn.py)',\n 'played': 'BROWSE ticks the tracks loaded on this player since it was switched on (ours: cdj900nxs/played.py)',\n 'wide_waveform': 'the big waveform to the right edge, the ZOOM/GRID wheel replaced by a small ZOOM / GRID box '\n '(ours: cdj900nxs/widewave.py)',\n 'browseinfo': 'BROWSE: every track row shows its BPM and key on the right (ours: cdj900nxs/browseinfo.py)',\n 'divhold': 'a BEAT DIVIDE key held down keeps its divide only while held, UTILITY > DIVIDE HOLD '\n '(ours: cdj900nxs/divhold.py)',\n 'flacplay': 'FLAC files play like WAVs (16/24 bit, up to 192 kHz), also over LINK (ours: cdj900nxs/flacplay.py)',\n 'exfatfs': 'exFAT USB sticks work as FAT32 ones do, also what the player writes to them (ours: cdj900nxs/exfatfs.py)',\n 'credit': 'boot screen says \"Pionaarr Mods 1.0\" instead of \"Ver 1.31\" (ours: cdj900nxs/credit.py)',\n}\n# every mod's version (Semantic Versioning); ours from their modules, arnoldasr's\n# split-up mods as packaged here\nVERSIONS = {\n 'extended_bpm': '1.0.0', 'phasemeter': '1.2.0', 'advanced_waveforms': wavemodes.VERSION, # with its WAVEFORM modes (wavefix: wavefix.VERSION)\n 'beatjump': beatjump.VERSION, 'cuecolours': cuecolours.VERSION, 'hotcuekeys': hotcuekeys.VERSION,\n 'ledsaver': ledsaver.VERSION, 'keynotation': keynotation.VERSION, 'usbautoload': usbautoload.VERSION,\n 'quicksearch': quicksearch.VERSION,\n 'cuenames': cuenames.VERSION, 'endwarn': endwarn.VERSION, 'played': played.VERSION,\n 'wide_waveform': widewave.VERSION, 'divhold': divhold.VERSION, 'browseinfo': browseinfo.VERSION, 'flacplay': flacplay.VERSION,\n 'exfatfs': exfatfs.VERSION, 'credit': credit.VERSION,\n}\nMANIFESTS = {\n 'phasemeter': 'mods/phase-meter-utility.cdjmod.json',\n 'advanced_waveforms': 'mods/waveform-colour.cdjmod.json',\n}\n# arnoldasr's code mod split up: each feature's hooks in the application\nUPSTREAM = ('extended_bpm', 'phasemeter', 'advanced_waveforms')\nHOOKS = {\n 'extended_bpm': (0x08BD3E50, 0x08BD3ED8, 0x08BD3A48, 0x08BCBA60, 0x08BCBCFC),\n 'phasemeter': (0x08B2E2EE, 0x08C6A6CC, 0x08C6CCD0),\n 'advanced_waveforms': (0x089A061C, 0x08BC6830, 0x08BC6A7C, 0x08BCFD72, 0x08BCFF50),\n}\nSHARED_HOOKS = (0x08C071FC, 0x08B27BC8) # startup binding, arena reset: BPM and phase\nBPM_INSTALL_CALL = 0x08FC2444 # startup_bind's jsr of the BPM digits' installer\nPHASE_MARKERS_CALL = 0x08FC2450 # ... and of the phase markers' (startup_markers)\n\n\ndef source_dir():\n return os.environ.get('CDJ900NXS_MODS_SRC') or os.path.join(HERE, 'cdj900nxs', 'upstream')\n\n\ndef read_json(rel):\n path = os.path.join(source_dir(), rel)\n if not os.path.isfile(path):\n raise SystemExit('patch_cdj900nxs: %s missing -- check out '\n 'https://github.com/arnoldasr/cdj900nxs into %s'\n % (path, source_dir()))\n with open(path, encoding='utf-8') as f:\n return json.load(f)\n\n\ndef sha(data):\n return hashlib.sha256(data).hexdigest()\n\n\n# The asset blob, as tools/phase_assets.py builds it (same constants).\nTABLE, DESCRIPTOR, ORIGINAL_COUNT, TEMPLATE = 0x08100000, 0x2C, 0x2A1, 0x1C8\nDATA_BASE = 0x08FC2D00\nWIDTH, HEIGHT, MARKER_WIDTH, BAR = 200, 24, 8, 5\nKEY = 0xF81F\nORANGE_LINE, ORANGE_MARK = (120, 65, 20), (255, 140, 0)\nBLUE_LINE, BLUE_MARK = (40, 90, 120), (60, 170, 255)\nWAVE_COLOURS = [\n 448, 457, 47, 458, 449, 111, 495, 466, 175, 467, 487, 239, 303, 479, 367, 459, 456, 431,\n 468, 465, 475, 476, 474, 39, 477, 31, 471, 46, 469, 45, 23, 460, 109, 484, 110, 485, 103,\n 478, 483, 493, 494, 486, 95, 15, 450, 167, 492, 173, 174, 231, 115, 470, 238, 44, 237, 159,\n 295, 87, 108, 302, 51, 301, 491, 482, 359, 223, 366, 365, 236, 300, 179, 423, 461, 287, 430,\n 429, 172, 364, 473, 428, 351, 114, 151, 463, 299, 363, 415, 215, 427, 178, 490, 50, 279, 235,\n 79, 462, 451, 343, 511, 298, 362, 400, 52, 116, 426, 234, 407, 7, 143, 180, 207, 113, 233,\n 243, 481, 57, 271, 452, 417, 177]\nWHITENESS_COLOURS = [(150, 20, 20), (220, 40, 30), (255, 110, 20), (255, 190, 30), (170, 230, 60),\n (40, 210, 170), (60, 160, 255), (225, 240, 255)]\n\n\ndef rgb565(rgb):\n r, g, b = rgb\n return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3)\n\n\ndef line_image(colour):\n px = [KEY] * (WIDTH * HEIGHT)\n for x in range(2, WIDTH - 2):\n px[12 * WIDTH + x] = rgb565(colour)\n for i in range(5):\n x = 2 + i * (WIDTH - 5) // 4\n for y in range(7, 18):\n px[y * WIDTH + x] = rgb565(colour)\n return px\n\n\ndef marker_image(colour):\n return [rgb565(colour) if 3 <= y <= 21 and x < BAR else KEY\n for y in range(HEIGHT) for x in range(MARKER_WIDTH)]\n\n\ndef rgb9(code):\n return tuple(((code >> shift) & 7) * 255 // 7 for shift in (6, 3, 0))\n\n\ndef wave_palette():\n colours = WHITENESS_COLOURS + [rgb9(c) for c in WAVE_COLOURS]\n return struct.pack('<128H', *[rgb565(c) for c in colours])\n\n\ndef wave_lut():\n def nearest(code):\n r, g, b = (code >> 6) & 7, (code >> 3) & 7, code & 7\n return min(range(len(WAVE_COLOURS)), key=lambda i: (\n (((WAVE_COLOURS[i] >> 6) & 7) - r) ** 2 + (((WAVE_COLOURS[i] >> 3) & 7) - g) ** 2\n + ((WAVE_COLOURS[i] & 7) - b) ** 2, i))\n return bytes(8 + nearest(code) for code in range(512))\n\n\ndef assets(app):\n images = [(WIDTH, line_image(ORANGE_LINE)), (WIDTH, line_image(BLUE_LINE)),\n (MARKER_WIDTH, marker_image(ORANGE_MARK)), (MARKER_WIDTH, marker_image(BLUE_MARK))]\n original = app[TABLE - BASE:TABLE - BASE + ORIGINAL_COUNT * DESCRIPTOR]\n template = original[TEMPLATE * DESCRIPTOR:(TEMPLATE + 1) * DESCRIPTOR]\n count = ORIGINAL_COUNT + len(images)\n table_bytes = count * DESCRIPTOR\n pixels_base = DATA_BASE + ((table_bytes + 31) & ~31)\n table, pixels = bytearray(original), bytearray()\n for i, (width, data) in enumerate(images):\n entry = bytearray(template)\n struct.pack_into(' mov #0,r0 (not installed)\n if 'phasemeter' not in names:\n call(PHASE_MARKERS_CALL, 0x410B, 0x0009) # jsr @r1 -> nop\n return bytes(out)\n\n\ndef apply_manifest(app, stock, name):\n doc = read_json(MANIFESTS[name])\n if doc['target']['application_sha256'] != APP_SHA256:\n raise SystemExit('patch_cdj900nxs: %s targets another application' % name)\n out = bytearray(app)\n for p in doc['patches']:\n off = int(p['offset'], 16) if isinstance(p['offset'], str) else p['offset']\n before, after = bytes.fromhex(p['expect']), bytes.fromhex(p['replace'])\n if len(before) != len(after) or off + len(before) > APP_SIZE:\n raise SystemExit('patch_cdj900nxs: %s: bad patch at 0x%x' % (name, off))\n if stock[off:off + len(before)] != before or app[off:off + len(before)] != before:\n raise SystemExit('patch_cdj900nxs: %s: bytes at 0x%x are not the expected original'\n % (name, off))\n out[off:off + len(before)] = after\n return bytes(out)\n\n\n# old names still taken\nALIASES = {'rgb_waveform': 'advanced_waveforms', 'waveform3band': 'advanced_waveforms',\n 'phasereverse': 'phasemeter'}\n\n\ndef check_names(names):\n \"\"\"The names with old ones taken, every mod known and what each needs.\"\"\"\n names = list(dict.fromkeys(ALIASES.get(n, n) for n in names))\n unknown = [n for n in names if n not in MODS]\n if unknown:\n raise SystemExit('patch_cdj900nxs: unknown mod(s) %s; known: %s'\n % (', '.join(unknown), ', '.join(MODS)))\n if 'cuenames' in names and 'cuecolours' not in names:\n raise SystemExit('patch_cdj900nxs: cuenames needs cuecolours (its cue reader brings the comments)')\n if 'beatjump' in names and not {'cuecolours', 'hotcuekeys'} <= set(names):\n raise SystemExit('patch_cdj900nxs: beatjump needs cuecolours and hotcuekeys '\n '(the jumps are made by hotcuekeys)')\n return names\n\n\ndef patch_upstream(stock, names):\n \"\"\"Stage 1: arnoldasr's mods (his code and assets, his manifests, and\n advanced_waveforms' fix that sits on his code). The website's builder\n has this stage as data (tools/make_builder_data.py).\"\"\"\n upstream = [n for n in UPSTREAM if n in names]\n app = apply_code(stock, upstream) if upstream else stock\n for name in ('phasemeter', 'advanced_waveforms'):\n if name in names:\n app = apply_manifest(app, stock, name)\n if 'advanced_waveforms' in names:\n app = wavefix.patch(app, stock) # 1.0.1: a slightly short PWV5 is taken too\n return app\n\n\ndef patch_ours(app, stock, names):\n \"\"\"Stage 2: our mods, on the application stage 1 made (the website's\n builder runs this function itself, in the browser).\"\"\"\n if 'beatjump' in names:\n app = beatjump.patch(app, stock)\n app = dspjump.patch(app, stock) # the jumps in the DSP's decoded audio\n if 'cuecolours' in names:\n app = cuecolours.patch(app, stock)\n if 'hotcuekeys' in names:\n app = hotcuekeys.patch(app, stock)\n if 'ledsaver' in names:\n app = ledsaver.patch(app, stock)\n if 'keynotation' in names:\n app = keynotation.patch(app, stock)\n if 'cuenames' in names:\n app = cuenames.patch(app, stock) # after keynotation: chains its text draw\n if 'played' in names:\n app = played.patch(app, stock) # after keynotation and cuenames: chains their text draw\n if 'browseinfo' in names:\n app = browseinfo.patch(app, stock) # after played: chains its text draw\n if 'endwarn' in names:\n app = endwarn.patch(app, stock)\n if 'usbautoload' in names:\n app = usbautoload.patch(app, stock)\n if 'quicksearch' in names:\n app = quicksearch.patch(app, stock)\n if 'phasemeter' in names:\n app = phasereverse.patch(app, stock) # PHASE METER: OFF / ON / REVERSE\n app = phasereverse.shift_bars(app, stock) # the beat countdown clear of the line meter\n if 'advanced_waveforms' in names:\n app = wavemodes.patch(app, stock) # UTILITY > WAVEFORM: BLUE / RGB / 3BAND\n if 'wide_waveform' in names:\n app = widewave.patch(app, stock) # after advanced_waveforms (its centre-row literal) and hotcuekeys (the draw method)\n if 'divhold' in names:\n app = divhold.patch(app, stock) # last on the decoder: sees the keys the others leave to the deck\n if 'flacplay' in names:\n app = flacplay.patch(app, stock) # the stdio entries and the file type copy\n if 'exfatfs' in names:\n app = exfatfs.patch(app, stock) # the USB sector read/write and the stick attach\n if 'credit' in names:\n app = credit.patch(app, stock)\n return app\n\n\ndef patch(data, names, public=False):\n \"\"\"The patched application for the mods named, in a fixed order: stage 1\n (arnoldasr's) and stage 2 (ours). Everything is released now; `public`\n is still taken and changes nothing.\"\"\"\n names = check_names(names)\n stock = data[:APP_SIZE]\n if sha(stock) != APP_SHA256:\n raise SystemExit('patch_cdj900nxs: not the CDJ-900NXS 1.31 application')\n return patch_ours(patch_upstream(stock, names), stock, names)\n\n\ndef main():\n args = sys.argv[1:]\n if args == ['--list']:\n for name, what in MODS.items():\n print('%-13s %-6s %s' % (name, VERSIONS[name], what))\n return\n if len(args) != 3:\n raise SystemExit(__doc__)\n names = [n for n in args[2].replace(' ', ',').split(',') if n]\n with open(args[0], 'rb') as f:\n out = patch(f.read(), names)\n with open(args[1], 'wb') as f:\n f.write(out)\n print('patch_cdj900nxs: %s (%s), %d bytes, sha256 %s'\n % (args[1], ','.join(names), len(out), sha(out)))\n\n\nif __name__ == '__main__':\n main()\n","mods/cdj900nxs/beatjump.py":"# SPDX-License-Identifier: GPL-2.0-or-later\n\"\"\"BEAT JUMP for the CDJ-900NXS 1.31: TRACK SEARCH jumps N beats along the\ntrack's beat grid, N set in UTILITY > BEAT JUMP (OFF/1/2/4/8, default 4).\n\nOur own mod, not arnoldasr's; mods/patch_cdj900nxs.py applies it as `beatjump`.\nEverything here was found by tracing the firmware in the emulator:\n\n * The UI's poller calls the panel decoder 0x08B63278 (through its literal\n at 0x08B622A8), which turns report byte 0x12 bits 0x04 / 0x08 of the\n frame at 0x0B2E8280 into the key bits TRACK - (0x0B2E82C6 bit 0x01) and\n TRACK + (0x0B2E82C5 bit 0x80); later readers (0x08B630D0) turn those\n into the track search. The literal now points at bj_poll, which runs the\n decoder and then, with BEAT JUMP on and a beat grid loaded, takes both\n key bits out again: the track search never starts, so neither the UI nor\n the player changes track, and a press is a jump instead. (Clearing the\n report byte before the decoder instead lost a race with the panel task\n refilling the frame.)\n * The jump is made by hotcuekeys' engine (hk_engine's he_bj, which is\n why beatjump needs hotcuekeys and cuecolours): bj_poll writes the\n target in 1/150 s with bit 31 set to hotcuekeys.BJ_REQ, the tick of\n the press to BJ_TICK and the jump's length in ms to BJ_DELTA, unless a\n jump is still waiting. The engine has the DSP move its playing head by\n that many 1/75 s slots inside the audio it has already decoded\n (dspjump.py, a patch of the audio DSP): at once, gapless, the CUE point\n stays, playing, paused or at cue standby (standing, the UI is left\n paused, so PLAY plays on from there). Only where the DSP has not that\n much audio decoded does it refuse: playing, the engine then loads the\n target into the beat jumps' own DSP cue slot (hotcuekeys.BJ_SLOT) the\n old way, moved on by the time such a load takes so the deck comes back\n in phase; standing, the press is dropped (the old way there, a memory\n CALL, left the UI waiting for good after the third or fourth).\n [Since: no fallback at all; the slot load left the deck standing. A\n press the DSP cannot jump now (it keeps dspjump.MARGIN decoded ahead, so\n the time needed grows with the setting) or made while a jump still\n waits is ignored: nothing is put off, the next press counts again.]\n * The setting is kept in the player's settings journal (hotcuekeys'\n hk_save2/hk_load2 through HK_API, id SAVE_ID): the first poll takes the\n last saved value (else DEFAULT, 4 beats) into the setting's word, a\n change is written back. The firmware itself kept SCREEN SAVER's ON/OFF\n only, so BEAT JUMP came back as 1 after a restart.\n * The grid is read as arnoldasr's phase meter reads it, from the player\n context 0x099445DC: track *(ctx+0x20), X = *(track+0xC4), grid\n *(X+0x104), timestamp adjustment *(X+0x10C); 0x08A27D4C(grid, adj,\n pos_ms) gives 1 + the index of the beat at or before pos_ms, 0x08A0EFB6\n (record, adj) a beat's time in ms. The position in ms is ctx+0x2CC.\n * A jump keeps the position's offset within its beat: target = pos +\n t[i +/- N] - t[i]. Before the first beat (a track just loaded stands at\n its CUE, often a hair before beat 1) i is beat 0. A press whose target\n would leave the grid does nothing, nor does one whose target is the\n last beat (it could lie past the track's end) or one made past the\n last beat (the deck standing at the end). With the setting OFF, or no grid, TRACK SEARCH is untouched.\n\nUTILITY > SCREEN SAVER (item 14, a word at 0x0A4DD270 + 0x1760, values\nOFF/ON, factory default ON = 1) becomes BEAT JUMP: its label in all 19\nlanguages, five values OFF/1/2/4/8 (the existing \"OFF\" and MIDI CHANNEL's digit\nstrings), so the old ON is now \"1\". The screen saver itself no longer reads\nthe setting: its getter literal (0x08BB7E60) points at a firmware tail that\nreturns 1, so it stays on as it was by default.\n\"\"\"\nimport os\nimport struct\nimport sys\n\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nimport hotcuekeys # noqa: E402\n\nVERSION = '1.0.2' # Semantic Versioning: MAJOR.MINOR.PATCH\n\nBASE = 0x08000000\nBJ_BASE = 0x08FCF400 # after arnoldasr's code mod (ends 0x08FCF260)\n\nPLAYER_CTX = 0x099445DC\nDECODER_LIT = 0x08B622A8 # the UI poller's literal of the panel decoder\nDECODER = 0x08B63278\nKEYS_TRACK = 0x0B2E82C5 # decoded keys: TRACK + is bit 0x80 here, TRACK - 0x01 of the next byte\nSEND = 0x08B3B666 # the UI's player-message builder\nGET_SETTING = 0x08AFD9E0 # SCREEN SAVER getter: *(0x0A4DD270 + 0x1760)\nGRID_LOOKUP = 0x08A27D4C\nGRID_TIME = 0x08A0EFB6\nFPSCR_MASK = 0xFFE7FFFF # what the firmware does to fpscr after every call\n\nSAVER_ITEM = 0x08C6CBB4 # UTILITY item 14 (copied to RAM at start-up)\nSAVER_CONSUMER_LIT = 0x08BB7E60 # the screen saver's literal of the getter\nRETURN_ONE = 0x08BDA1B0 # 'rts; mov #1,r0' at the end of a firmware function\nVALUE_STRINGS = [0xA80D013C, 0xA80D0144, 0xA80D0148, 0xA80D0150, 0xA80D0160] # OFF 1 2 4 8\nLABEL_OLD = 'SCREEN SAVER\\0'.encode('utf-16-le')\nLABEL_NEW = 'BEAT JUMP'.encode('utf-16-le').ljust(len(LABEL_OLD), b'\\0')\nLABEL_COPIES = 19\n\nVALUE_LIST = BJ_BASE + 0x400 # the five value-string pointers, after the code\nPREV_BITS = BJ_BASE + 0x3FC # last frame's TRACK bits, for press edges\nLAST_SET = BJ_BASE + 0x3F8 # word: the setting last seen (-1 at start: taken from the journal then)\nSETTING = 0x0A4DD270 + 0x1760 # the setting's word (the SCREEN SAVER's)\nSAVE_ID = 0x83E2 # ours in the settings journal (hotcuekeys' is 0x83E1)\nDEFAULT = 3 # 4 beats\nBJ_DELTA = 0x08FCF818 # word: the last jump's length in ms (signed), for hotcuekeys' DSP jump\nBJ_POSV = hotcuekeys.BJ_POSV # word: the position (ms) to reckon from, if not 0\nBJ_PEND = hotcuekeys.BJ_PEND # word: presses counted while hotcuekeys' CALL had no grid\n\n\nclass Asm:\n \"\"\"Just enough SH-4 to write bj_poll: two passes over a list of\n instructions, labels, and a literal pool of .long/.word constants.\"\"\"\n\n def __init__(self, base):\n self.base, self.items, self.labels = base, [], {}\n\n def label(self, name):\n self.items.append(('label', name))\n\n def op(self, fn):\n self.items.append(('op', fn))\n\n def long(self, name, value):\n self.items.append(('align4', None))\n self.label(name)\n self.items.append(('long', value))\n\n def word(self, name, value):\n self.label(name)\n self.items.append(('word', value))\n\n def assemble(self):\n for final in (False, True):\n pc, out = self.base, bytearray()\n for kind, arg in self.items:\n if kind == 'label':\n self.labels[arg] = pc\n continue\n if kind == 'align4':\n while pc % 4:\n out += struct.pack('> 36 = q / 20\n a.long('L_req', hotcuekeys.BJ_REQ)\n a.long('L_tick', hotcuekeys.TICK)\n a.long('L_bit31', 0x80000000)\n a.long('L_delta', BJ_DELTA)\n a.long('L_posv', BJ_POSV)\n a.long('L_pend', BJ_PEND)\n a.long('L_third', 0xAAAAAAAB) # q * this >> 33 = q / 3\n a.long('L_last', LAST_SET)\n a.long('L_setting', SETTING)\n a.long('L_bjid', SAVE_ID)\n a.long('L_bjid16', SAVE_ID << 16)\n a.long('L_api', hotcuekeys.HK_API)\n code = a.assemble()\n return code, None\n\n\ndef patch(app, stock):\n \"\"\"The application with BEAT JUMP added; `stock` is the unmodified 1.31\n application, which every replaced byte is checked against.\"\"\"\n code, _ = routine()\n assert len(code) <= LAST_SET - BJ_BASE\n out = bytearray(app)\n end = VALUE_LIST + 4 * len(VALUE_STRINGS) - BASE\n if len(out) < end:\n out += bytes(end - len(out))\n if any(out[BJ_BASE - BASE:end]):\n raise SystemExit('patch_cdj900nxs: beatjump: its area 0x%08x.. is not free' % BJ_BASE)\n\n def put(addr, before, after):\n off = addr - BASE\n if stock[off:off + len(before)] != before or out[off:off + len(before)] != before:\n raise SystemExit('patch_cdj900nxs: beatjump: bytes at 0x%08x are not the expected original'\n % addr)\n out[off:off + len(after)] = after\n\n out[BJ_BASE - BASE:BJ_BASE - BASE + len(code)] = code\n out[LAST_SET - BASE:LAST_SET - BASE + 4] = b'\\xff\\xff\\xff\\xff'\n out[VALUE_LIST - BASE:end] = b''.join(struct.pack('= 0:\n put(BASE + at, LABEL_OLD, LABEL_NEW)\n found += 1\n at = stock.find(LABEL_OLD, at + 2)\n if found != LABEL_COPIES:\n raise SystemExit('patch_cdj900nxs: beatjump: %d SCREEN SAVER labels, expected %d'\n % (found, LABEL_COPIES))\n return bytes(out)\n","mods/cdj900nxs/browseinfo.py":"# SPDX-License-Identifier: GPL-2.0-or-later\n\"\"\"BROWSE INFO for the CDJ-900NXS 1.31: in BROWSE every track's row shows its\nBPM and key on the right, as on the newer players. Our own mod;\nmods/patch_cdj900nxs.py applies it as `browseinfo`, after `played`.\n\n * The rows carry the title only; the player's DB keeps ids, BPM and key\n to itself. bi_poll (after the panel decoder) reads the rekordbox export\n of the USB itself once the stick is mounted (USB_STATE 3), one 4 KiB\n page every STEP_TICKS (SLOW_TICKS with the browse screen open, none while\n the browse screen waits for a list from the DB or a quick search way runs:\n browsing comes first), through the DB's own stdio (FOPEN .. FCLOSE, the\n functions the DB task reads export.pdb with; the file system serves\n every task): the header page's table list, the keys table (type 5:\n id, then the name as a DeviceSQL string) into KEYS, then the tracks\n table (type 0: key id +0x20, tempo (BPM x 100) +0x38, the title's\n string at +0x80's offset) into a hash table (SLOTS entries of 8 bytes\n from malloc: FNV-1a of the title's UTF-16 units, tempo, key id;\n open addressing, the first of two equal titles kept). Pulled out, it is\n all dropped (and read again when a stick comes).\n * Text widgets are drawn by the method in the class table entry DRAW_LIT\n (r4 the renderer, r5 the widget: +0x18 x0, y0, +0x1C x1, y1 (16 bits\n each), +40 colour, +52 text). A BROWSE row's widget draws the UI's copy\n of the row, ROWS + k * ROW_LEN (k 0-6). bi_draw takes the entry (in\n front of played's, which it calls): a row whose text is a title in the\n table is drawn three times: the title with x1 - COLS, the BPM (\"145.0\")\n from x1 - BPM_X, the key from x1 - KEY_X, in the row's colour (the key\n through keynotation's draw, which writes it in the chosen notation and\n colour). Rows narrower than MIN_W stay as they are.\n * Other players' media over Pro DJ Link: their rows are looked up in this\n stick's export (a track also on it shows its BPM and key).\n\"\"\"\nimport os\nimport struct\nimport sys\n\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nimport sh4asm # noqa: E402\nimport hotcuekeys # noqa: E402\nimport quicksearch # noqa: E402\n\nVERSION = '0.2.0' # Semantic Versioning: MAJOR.MINOR.PATCH\n\nBASE = 0x08000000\nBI_BASE = 0x08FEE400 # after quicksearch's hold 0x08FEE000..0x08FEE400\nBI_END = 0x08FF0800\nBI_STATE = BI_BASE # +0 byte step (0 idle, 1 keys, 2 tracks, 3 done, 4 failed), +4 FILE,\n # +8 the table, +12 the page, +16 its table's last page, +20/+24 the\n # tracks' first/last page, +28 pages read, +32 last step's tick,\n # +36 titles in the table, +40 the BPM's text (16 bytes)\nKEYS = BI_BASE + 0x40 # 64 x 16 bytes: key id -> its name (UTF-16, NUL)\nNKEYS = 64\nPAGE = BI_BASE + 0x480 # 4096 bytes: the page read\nPAGE_LEN = 4096\nPATH = PAGE + PAGE_LEN # the export, ASCII\nPATH_TEXT = b'C:/PIONEER/rekordbox/export.pdb\\0'\nBI_CODE = PATH + 0x30\n\nSLOTS = 16384 # the hash table: 128 KiB from malloc\nMAX_PAGES = 16384\nSTEP_TICKS = 2 # a page every 20 ms\nSLOW_TICKS = 6 # ... every 60 ms while the browse screen is open\nUSB_STATE = 0x0A4DE78C # 3: the USB mounted\nMALLOC, FREE = 0x08A5C6EC, 0x08A5EBC2\nMEMSET = 0x08C28038\nFOPEN, FCLOSE, FREAD, FSEEK = 0x089A07A4, 0x089A0834, 0x089A0844, 0x089A0868\nMODE_R = 0x080EEAE4 # \"r\"\n\nDRAW_LIT = 0x080B27F4\nROWS = 0x0B7CE84E # the UI's copy of the rows: row k's text at ROWS + k * ROW_LEN\nROW_LEN = 0x220\nNROWS = 7\nCOLS = 118 # the title stops this far left of the row's end\nBPM_X, BPM_W = 112, 62 # the BPM from x1 - BPM_X, BPM_W wide (+ DIGIT_W below 100 BPM: aligned)\nDIGIT_W = 12\nKEY_X = 42 # the key from x1 - KEY_X to x1\nMIN_W = 340 # a full row (INFO's narrower rows, whose pane shows BPM and key, stay)\n\nSOURCE = r'''\n; ---- bi_poll: the panel decoder (or whatever ran there), then a step of\n; reading the export\nbi_poll:\n sts.l pr,@-r15\n mov.l A_prev,r0\n jsr @r0\n nop\n mov.l r0,@-r15 ; the decoder's result, returned as it is\n mov.l r8,@-r15\n mov.l r9,@-r15\n mov.l r10,@-r15\n mov.l r11,@-r15\n mov.l r12,@-r15\n mov.l r13,@-r15\n mov.l r14,@-r15\n mov.l A_state,r14\n mov.l A_usb,r1\n mov.l @r1,r0\n cmp/eq #3,r0\n bt bp_usb\n mov.b @r14,r0 ; no USB: everything dropped\n tst r0,r0\n bt bp_out\n bsr bi_reset\n nop\n bra bp_out\n nop\nbp_usb:\n mov.b @r14,r0\n cmp/eq #3,r0\n bt bp_out ; done\n cmp/eq #4,r0\n bt bp_out ; nothing to read\n mov.l A_brctx,r1 ; the browse screen waiting for the DB, or a quick search way\n mov.l @(20,r1),r2 ; under way: the stick is theirs first\n mov.l @(24,r1),r3\n or r3,r2\n mov.l @(28,r1),r3\n or r3,r2\n mov.l @(32,r1),r3\n or r3,r2\n mov.l A_freeze,r1\n mov.b @r1,r3\n or r3,r2\n tst r2,r2\n bf bp_out\n mov #STEP_TICKS,r5 ; a page every STEP_TICKS, every SLOW_TICKS with the screen open\n mov.l A_depth,r1\n mov.l @r1,r3\n tst r3,r3\n bt bp_rate\n mov #SLOW_TICKS,r5\nbp_rate:\n mov.l A_tick,r1\n mov.l @r1,r1\n mov.l @(32,r14),r2\n mov r1,r3\n sub r2,r3\n cmp/hs r5,r3\n bf bp_out\n mov.l r1,@(32,r14)\n tst r0,r0\n bf bp_page\n bsr bi_open\n nop\n bra bp_out\n nop\nbp_page:\n bsr bi_page\n nop\nbp_out:\n mov.l A_fpmask,r1 ; FPSCR as the firmware leaves it after a call\n sts fpscr,r2\n and r1,r2\n lds r2,fpscr\n mov.l @r15+,r14\n mov.l @r15+,r13\n mov.l @r15+,r12\n mov.l @r15+,r11\n mov.l @r15+,r10\n mov.l @r15+,r9\n mov.l @r15+,r8\n mov.l @r15+,r0\n lds.l @r15+,pr\n rts\n nop\n\n; ---- bi_reset: r14 -> the state. The file closed, the table freed, idle\nbi_reset:\n sts.l pr,@-r15\n mov.l @(4,r14),r4\n tst r4,r4\n bt br_nofile\n mov.l A_fclose,r0\n jsr @r0\n nop\nbr_nofile:\n mov.l @(8,r14),r4\n tst r4,r4\n bt br_notab\n mov.l A_free,r0\n jsr @r0\n nop\nbr_notab:\n mov #0,r0\n mov.l r0,@(4,r14)\n mov.l r0,@(8,r14)\n mov.l r0,@(36,r14)\n mov.b r0,@r14\n lds.l @r15+,pr\n rts\n nop\n\n; ---- bi_fail: r14. Closed, nothing more read till the next stick (the table kept)\nbi_fail:\n sts.l pr,@-r15\n mov.l @(4,r14),r4\n tst r4,r4\n bt bf_k\n mov.l A_fclose,r0\n jsr @r0\n nop\nbf_k:\n mov #0,r0\n mov.l r0,@(4,r14)\n mov #4,r0\n mov.b r0,@r14\n lds.l @r15+,pr\n rts\n nop\n\n; ---- bi_open: r14. The table (malloc'd once, cleared), KEYS cleared, the file\n; opened, its header page read: the keys' and the tracks' first and last pages\nbi_open:\n sts.l pr,@-r15\n mov.l @(8,r14),r0\n tst r0,r0\n bf bo_have\n mov.l A_tabsize,r4\n mov.l A_malloc,r0\n jsr @r0\n nop\n tst r0,r0\n bt bo_fail\n mov.l r0,@(8,r14)\nbo_have:\n mov.l @(8,r14),r4\n mov #0,r5\n mov.l A_tabsize,r6\n mov.l A_memset,r0\n jsr @r0\n nop\n mov.l A_keys,r4\n mov #0,r5\n mov.l A_keyslen,r6\n mov.l A_memset,r0\n jsr @r0\n nop\n mov #0,r0\n mov.l r0,@(36,r14)\n mov.l r0,@(28,r14)\n mov.l A_path,r4\n mov.l A_moder,r5\n mov.l A_fopen,r0\n jsr @r0\n nop\n tst r0,r0\n bt bo_fail\n mov.l r0,@(4,r14)\n mov.l A_page,r4 ; the header page\n mov #1,r5\n mov.l A_pagelen,r6\n mov.l @(4,r14),r7\n mov.l A_fread,r0\n jsr @r0\n nop\n mov.l A_pagelen,r1\n cmp/eq r1,r0\n bf bo_fail\n mov.l A_page,r8\n mov r8,r4\n bsr rd32\n add #4,r4\n mov.l A_pagelen,r1 ; pages of 4096 bytes only\n cmp/eq r1,r0\n bf bo_fail\n mov r8,r4\n bsr rd32\n add #8,r4\n mov r0,r9 ; r9: tables\n mov #32,r1\n cmp/hi r1,r9\n bt bo_fail\n mov #0,r10 ; r10/r11: the keys' first/last, r12/r13 the tracks'\n mov #0,r11\n mov #0,r12\n mov #0,r13\n add #28,r8 ; the first table pointer: type, empty, first, last\nbo_tab:\n tst r9,r9\n bt bo_tabs\n mov r8,r4\n bsr rd32\n nop\n cmp/eq #0,r0\n bf bo_t5\n mov r8,r4\n bsr rd32\n add #8,r4\n mov r0,r12\n mov r8,r4\n bsr rd32\n add #12,r4\n bra bo_tnext\n mov r0,r13\nbo_t5:\n cmp/eq #5,r0\n bf bo_tnext\n mov r8,r4\n bsr rd32\n add #8,r4\n mov r0,r10\n mov r8,r4\n bsr rd32\n add #12,r4\n mov r0,r11\nbo_tnext:\n add #16,r8\n bra bo_tab\n add #-1,r9\nbo_tabs:\n tst r12,r12\n bt bo_fail ; no tracks table\n mov.l r12,@(20,r14)\n mov.l r13,@(24,r14)\n tst r10,r10\n bt bo_tracks\n mov.l r10,@(12,r14) ; the keys first\n mov.l r11,@(16,r14)\n mov #1,r0\n bra bo_out\n mov.b r0,@r14\nbo_tracks:\n mov.l r12,@(12,r14)\n mov.l r13,@(16,r14)\n mov #2,r0\n bra bo_out\n mov.b r0,@r14\nbo_fail:\n bsr bi_fail\n nop\nbo_out:\n lds.l @r15+,pr\n rts\n nop\n\n\n .align 4\nA_fclose: .long FCLOSE\nA_fopen: .long FOPEN\nA_fpmask: .long 0xFFE7FFFF\nA_fread: .long FREAD\nA_free: .long FREE\nA_keys: .long KEYS\nA_keyslen: .long KEYSLEN\nA_malloc: .long MALLOC\nA_memset: .long MEMSET\nA_moder: .long MODE_R\nA_page: .long PAGE\nA_pagelen: .long PAGE_LEN\nA_path: .long PATH\nA_prev: .long PREV_DECODER\nA_state: .long BI_STATE\nA_tabsize: .long TABSIZE\nA_tick: .long TICK\nA_usb: .long USB_STATE\nA_brctx: .long BR_CTX\nA_freeze: .long QS_FREEZE\nA_depth: .long DEPTH\n\n; ---- bi_page: r14. The page read and its rows taken (keys or tracks), then\n; the next page; after the keys' last the tracks', after theirs done\nbi_page:\n sts.l pr,@-r15\n mov.l @(4,r14),r4 ; fseek(FILE, page * 4096, 0)\n mov.l @(12,r14),r5\n shll8 r5\n shll2 r5\n shll2 r5\n mov #0,r6\n mov.l B_fseek,r0\n jsr @r0\n nop\n mov.l B_page,r4\n mov #1,r5\n mov.l B_pagelen,r6\n mov.l @(4,r14),r7\n mov.l B_fread,r0\n jsr @r0\n nop\n mov.l B_pagelen,r1\n cmp/eq r1,r0\n bt bg_read\n bra bg_done ; short: what there is is kept\n nop\nbg_read:\n mov.l B_page,r8\n mov r8,r0\n add #27,r0\n mov.b @r0,r0 ; flags: 0x40 = an index page\n tst #64,r0\n bf bg_next\n mov r8,r4\n bsr rd16\n add #24,r4\n mov.l B_nrmask,r1\n and r1,r0\n mov r0,r9 ; r9: row offsets\n mov #0,r10 ; r10: the row\nbg_row:\n cmp/hs r9,r10\n bt bg_next\n mov r10,r11 ; group base = page end - (row >> 4) * 0x24\n shlr2 r11\n shlr2 r11\n mov #36,r1\n mulu.w r1,r11\n sts macl,r11\n mov.l B_pagelen,r12\n add r8,r12\n sub r11,r12 ; r12: the group's end\n mov r12,r4\n bsr rd16\n add #-4,r4 ; present flags\n mov r10,r1\n mov #15,r2\n and r2,r1\n neg r1,r1\n shld r1,r0\n tst #1,r0\n bt bg_rnext\n mov r10,r1 ; its offset at group end - 6 - 2 * (row & 15)\n mov #15,r2\n and r2,r1\n add r1,r1\n mov r12,r4\n add #-6,r4\n bsr rd16\n sub r1,r4\n mov.l B_rowmax,r1\n cmp/hs r1,r0\n bt bg_rnext ; (past the page)\n mov r8,r4\n add #40,r4\n add r0,r4 ; r4: the row\n mov.b @r14,r0\n cmp/eq #1,r0\n bt bg_key\n bsr bi_track\n nop\n bra bg_rnext\n nop\nbg_key:\n bsr bi_key\n nop\nbg_rnext:\n bra bg_row\n add #1,r10\nbg_next:\n mov.l @(28,r14),r0\n add #1,r0\n mov.l r0,@(28,r14)\n mov.l B_maxpages,r1\n cmp/hs r1,r0\n bt bg_done\n mov.l @(12,r14),r1\n mov.l @(16,r14),r2\n cmp/eq r2,r1\n bt bg_tabend\n mov r8,r4 ; the next page\n bsr rd32\n add #12,r4\n tst r0,r0\n bt bg_tabend\n mov.l B_maxpages,r1\n cmp/hs r1,r0\n bt bg_tabend\n bra bg_out\n mov.l r0,@(12,r14)\nbg_tabend:\n mov.b @r14,r0\n cmp/eq #1,r0\n bf bg_done\n mov.l @(20,r14),r0 ; the keys done: the tracks\n mov.l r0,@(12,r14)\n mov.l @(24,r14),r0\n mov.l r0,@(16,r14)\n mov #2,r0\n bra bg_out\n mov.b r0,@r14\nbg_done:\n mov.l @(4,r14),r4 ; all read: closed, done\n tst r4,r4\n bt bg_d1\n mov.l B_fclose,r0\n jsr @r0\n nop\nbg_d1:\n mov #0,r0\n mov.l r0,@(4,r14)\n mov #3,r0\n mov.b r0,@r14\nbg_out:\n lds.l @r15+,pr\n rts\n nop\n\n; ---- bi_key: r4 a keys row: id, id2, name. The name into KEYS[id]\nbi_key:\n sts.l pr,@-r15\n mov.l r4,@-r15\n bsr rd32\n nop\n mov.l @r15+,r4\n mov #NKEYS,r1\n cmp/hs r1,r0\n bt bk_out\n shll2 r0\n shll2 r0\n mov.l B_keys,r5\n add r0,r5 ; r5: KEYS[id]\n add #8,r4\n bsr ds_str ; r4 the string -> r6 units, r7 the first, r3 1: UTF-16\n nop\n mov #7,r1\n cmp/hi r1,r6\n bf bk_n\n mov r1,r6\nbk_n:\n tst r6,r6\n bt bk_end\nbk_c:\n tst r3,r3\n bt bk_a\n mov r7,r4\n bsr rd16\n nop\n bra bk_put\n add #2,r7\nbk_a:\n mov.b @r7+,r0\n extu.b r0,r0\nbk_put:\n mov.w r0,@r5\n dt r6\n bf/s bk_c\n add #2,r5\nbk_end:\n mov #0,r0\n mov.w r0,@r5\nbk_out:\n lds.l @r15+,pr\n rts\n nop\n\n; ---- bi_track: r4 a tracks row. Its title's hash, tempo and key into the table\nbi_track:\n sts.l pr,@-r15\n mov.l r8,@-r15\n mov.l r9,@-r15\n mov r4,r8\n mov r8,r4\n bsr rd32\n add #32,r4\n extu.w r0,r9 ; r9: the key id\n mov r8,r4\n bsr rd32\n add #56,r4\n mov.l B_ffff,r1\n cmp/hi r1,r0\n bf bt_t\n mov r1,r0\nbt_t:\n shll16 r9\n or r0,r9 ; r9: key << 16 | tempo\n mov r8,r4\n mov #127,r1\n add #1,r1\n add r1,r4\n bsr rd16 ; the title's offset (string 17 of the row)\n nop\n mov.l B_rowmax,r1\n cmp/hs r1,r0\n bt bt_out\n mov r8,r4\n add r0,r4\n bsr ds_str\n nop\n bsr fnv ; r6 units at r7 (r3 1: UTF-16) -> r0 the hash\n nop\n mov r9,r5\n bsr bi_insert\n mov r0,r4\nbt_out:\n mov.l @r15+,r9\n mov.l @r15+,r8\n lds.l @r15+,pr\n rts\n nop\n\n; ---- bi_insert: r4 hash, r5 key << 16 | tempo (r14 the state); the first one stays\nbi_insert:\n mov.l @(8,r14),r2\n tst r2,r2\n bt bn_out\n tst r4,r4\n bf bn_h\n mov #1,r4\nbn_h:\n mov.l B_mask,r1\n mov r4,r3\n and r1,r3 ; r3: the slot\n mov.l B_slots,r6\nbn_loop:\n mov r3,r0\n shll2 r0\n shll r0\n add r2,r0\n mov.l @r0,r7\n tst r7,r7\n bt bn_put\n cmp/eq r4,r7\n bt bn_out\n add #1,r3\n and r1,r3\n dt r6\n bf bn_loop\n rts ; (full)\n nop\nbn_put:\n mov.l r4,@r0\n mov.l r5,@(4,r0)\n mov.l @(36,r14),r0\n add #1,r0\n mov.l r0,@(36,r14)\nbn_out:\n rts\n nop\n\n; ---- ds_str: r4 a DeviceSQL string -> r6 its units, r7 the first, r3 1 if\n; UTF-16 (0 units if none): short ASCII (b & 1: (b >> 1) - 1 bytes),\n; long ASCII (0x40: length at +1 with the 4-byte head), long UTF-16 (0x90)\nds_str:\n sts.l pr,@-r15\n mov #0,r6\n mov #0,r3\n mov.b @r4,r0\n extu.b r0,r0\n tst #1,r0\n bt dsl\n shlr r0\n add #-1,r0\n mov r0,r6\n mov r4,r7\n bra ds_out\n add #1,r7\ndsl:\n mov r0,r2\n mov.l r4,@-r15\n bsr rd16\n add #1,r4\n mov.l @r15+,r4\n add #-4,r0\n cmp/pz r0\n bf ds_none\n mov r4,r7\n add #4,r7\n mov r2,r1\n mov #64,r2\n cmp/eq r2,r1\n bf ds_u\n bra ds_out\n mov r0,r6\nds_u:\n mov #-112,r2 ; 0x90\n extu.b r2,r2\n cmp/eq r2,r1\n bf ds_none\n shlr r0\n mov r0,r6\n bra ds_out\n mov #1,r3\nds_none:\n mov #0,r6\nds_out:\n mov #127,r1 ; at most 255 units\n add #127,r1\n add #1,r1\n cmp/hi r1,r6\n bf ds_r\n mov r1,r6\nds_r:\n lds.l @r15+,pr\n rts\n nop\n\n; ---- fnv: r6 units at r7 (r3 1: UTF-16 little-endian, 0: bytes) -> r0 FNV-1a\n; over the 16-bit units; r1, r2, r6, r7 used\nfnv:\n mov.l B_fnvb,r0\n mov.l B_fnvp,r2\n tst r6,r6\n bt fv_out\nfv_loop:\n tst r3,r3\n bt fv_a\n mov.b @r7+,r1\n extu.b r1,r1\n mov.l r0,@-r15\n mov.b @r7+,r0\n extu.b r0,r0\n shll8 r0\n or r0,r1\n bra fv_x\n mov.l @r15+,r0\nfv_a:\n mov.b @r7+,r1\n extu.b r1,r1\nfv_x:\n xor r1,r0\n mul.l r2,r0\n dt r6\n bf/s fv_loop\n sts macl,r0\nfv_out:\n rts\n nop\n\n; ---- rd16 / rd32: r4 any address -> r0 (little-endian, byte by byte); r4 kept\nrd16:\n mov.b @(1,r4),r0\n extu.b r0,r0\n shll8 r0\n mov.l r1,@-r15\n mov.b @r4,r1\n extu.b r1,r1\n or r1,r0\n rts\n mov.l @r15+,r1\nrd32:\n mov.l r1,@-r15\n mov.b @(3,r4),r0\n extu.b r0,r1\n shll8 r1\n mov.b @(2,r4),r0\n extu.b r0,r0\n or r0,r1\n shll8 r1\n mov.b @(1,r4),r0\n extu.b r0,r0\n or r0,r1\n shll8 r1\n mov.b @r4,r0\n extu.b r0,r0\n or r1,r0\n rts\n mov.l @r15+,r1\n\n .align 4\nB_prev: .long PREV_DECODER\nB_state: .long BI_STATE\nB_usb: .long USB_STATE\nB_tick: .long TICK\nB_fpmask: .long 0xFFE7FFFF\nB_fclose: .long FCLOSE\nB_free: .long FREE\nB_tabsize: .long TABSIZE\nB_malloc: .long MALLOC\nB_memset: .long MEMSET\nB_keys: .long KEYS\nB_keyslen: .long KEYSLEN\nB_path: .long PATH\nB_moder: .long MODE_R\nB_fopen: .long FOPEN\nB_page: .long PAGE\nB_pagelen: .long PAGE_LEN\nB_fread: .long FREAD\nB_fseek: .long FSEEK\nB_nrmask: .long 0x1FFF\nB_rowmax: .long 4096 - 40\nB_maxpages: .long MAX_PAGES\nB_ffff: .long 0xFFFF\nB_mask: .long SLOTS - 1\nB_slots: .long SLOTS\nB_fnvb: .long 0x811C9DC5\nB_fnvp: .long 0x01000193\n\n; ---- bi_draw: the text widget's draw method (r4 renderer, r5 widget). A\n; BROWSE row that is a known title: the title shortened, then BPM and key\nbi_draw:\n mov.l D_state,r1\n mov.b @r1,r0\n cmp/eq #3,r0\n bf bd_go\n mov.l @(52,r5),r0 ; a row's text?\n mov.l D_rows,r1\n sub r1,r0\n cmp/pz r0\n bf bd_go\n mov.l D_rowsend,r1\n cmp/hs r1,r0\n bt bd_go\n mov.l D_rowlen,r1\nbd_mod:\n cmp/hs r1,r0\n bf bd_rem\n bra bd_mod\n sub r1,r0\nbd_rem:\n tst r0,r0\n bf bd_go\n mov.w @(28,r5),r0 ; x1 - x0 wide enough?\n mov r0,r2\n mov.w @(24,r5),r0\n sub r0,r2\n mov.l D_minw,r1\n cmp/ge r1,r2\n bt bd_ours\nbd_go:\n mov.l D_next,r0\n jmp @r0\n nop\nbd_ours:\n sts.l pr,@-r15\n mov.l r8,@-r15\n mov.l r9,@-r15\n mov.l r10,@-r15\n mov.l r11,@-r15\n mov.l r12,@-r15\n mov.l r13,@-r15\n mov r4,r8\n mov r5,r9\n mov.l @(52,r9),r7 ; its hash: UTF-16 to the NUL (255 units at most)\n mov r7,r4\n mov #0,r6\nbd_len:\n mov.w @r4+,r0\n tst r0,r0\n bt bd_l2\n add #1,r6\n mov #127,r1\n add #127,r1\n cmp/hs r1,r6\n bf bd_len\nbd_l2:\n mov #1,r3\n bsr bd_fnv\n nop\n tst r0,r0\n bf bd_h\n mov #1,r0\nbd_h:\n mov.l D_state,r1 ; looked up\n mov.l @(8,r1),r2\n tst r2,r2\n bt bd_plain\n mov.l D_mask,r1\n mov r0,r3\n and r1,r3\n mov.l D_slots,r6\nbd_look:\n mov r3,r4\n shll2 r4\n shll r4\n add r2,r4\n mov.l @r4,r7\n tst r7,r7\n bt bd_plain ; not known\n cmp/eq r0,r7\n bt bd_found\n add #1,r3\n and r1,r3\n dt r6\n bf bd_look\n bra bd_plain\n nop\nbd_found:\n mov.l @(4,r4),r10 ; r10: key << 16 | tempo\n mov.l @(52,r9),r11 ; r11: the text, r12: x0 | y0 << 16, r13: x1 | y1 << 16 (kept)\n mov.l @(24,r9),r12\n mov.l @(28,r9),r13\n mov.w @(28,r9),r0 ; the title: x1 - COLS\n mov.l D_cols,r2\n sub r2,r0\n mov.w r0,@(28,r9)\n mov r8,r4\n mov r9,r5\n mov.l D_next,r0\n jsr @r0\n nop\n extu.w r10,r4 ; the BPM (none at 0)\n tst r4,r4\n bt bd_key\n bsr bd_bpm ; -> D_bpmbuf, r0 1: three digits\n nop\n mov.l D_bpmbuf,r1\n mov.l r1,@(52,r9)\n mov r0,r3 ; (1: fewer digits, one digit further right)\n extu.w r13,r0 ; x1 as it was\n mov.l D_bpmx,r2\n sub r2,r0\n tst r3,r3\n bf bd_x\n add #DIGIT_W,r0\nbd_x:\n mov.w r0,@(24,r9)\n mov.l D_bpmw,r2\n add r2,r0\n mov.w r0,@(28,r9)\n mov r8,r4\n mov r9,r5\n mov.l D_next,r0\n jsr @r0\n nop\nbd_key:\n mov r10,r0 ; the key's name, if any\n shlr16 r0\n mov #NKEYS,r1\n cmp/hs r1,r0\n bt bd_restore\n shll2 r0\n shll2 r0\n mov.l D_keys,r1\n add r0,r1\n mov.w @r1,r0\n tst r0,r0\n bt bd_restore\n mov.l r1,@(52,r9)\n extu.w r13,r0\n mov r0,r1\n mov #KEY_X,r2\n sub r2,r0\n mov.w r0,@(24,r9)\n mov r1,r0\n mov.w r0,@(28,r9)\n mov r8,r4\n mov r9,r5\n mov.l D_next,r0\n jsr @r0\n nop\nbd_restore:\n mov.l r11,@(52,r9)\n mov.l r12,@(24,r9)\n mov.l r13,@(28,r9)\n bra bd_out\n nop\nbd_plain:\n mov r8,r4\n mov r9,r5\n mov.l D_next,r0\n jsr @r0\n nop\nbd_out:\n mov.l D_fpmask,r1\n sts fpscr,r2\n and r1,r2\n lds r2,fpscr\n mov.l @r15+,r13\n mov.l @r15+,r12\n mov.l @r15+,r11\n mov.l @r15+,r10\n mov.l @r15+,r9\n mov.l @r15+,r8\n lds.l @r15+,pr\n rts\n nop\n\n; ---- bd_fnv: as fnv (r6 units at r7, UTF-16) -> r0\nbd_fnv:\n mov.l D_fnvb,r0\n mov.l D_fnvp,r2\n tst r6,r6\n bt bdf_out\nbdf_loop:\n mov.w @r7+,r1\n extu.w r1,r1\n xor r1,r0\n mul.l r2,r0\n dt r6\n bf/s bdf_loop\n sts macl,r0\nbdf_out:\n rts\n nop\n\n; ---- bd_bpm: r4 the tempo (BPM x 100) -> \"145.0\" in D_bpmbuf (UTF-16); r0-r7\nbd_bpm:\n mov.l D_bpmbuf,r5\n mov.l D_div100,r1 ; whole = tempo / 100 (tempo < 65536)\n dmulu.l r1,r4\n sts mach,r6\n shlr2 r6\n shlr2 r6\n shlr r6 ; r6: whole\n mov #100,r1\n mulu.w r1,r6\n sts macl,r1\n mov r4,r7\n sub r1,r7 ; r7: the rest (0-99)\n mov.w D_205,r1 ; tenth = rest * 205 >> 11\n mulu.w r1,r7\n sts macl,r7\n shlr8 r7\n shlr2 r7\n shlr r7\n mov #48,r3 ; '0'\n mov r6,r0 ; hundreds (whole < 1000)\n mov #41,r1\n mulu.w r1,r0\n sts macl,r2\n shlr8 r2\n shlr2 r2\n shlr2 r2 ; r2: hundreds\n tst r2,r2\n bt bb_10\n mov r2,r0\n add r3,r0\n mov.w r0,@r5\n add #2,r5\n mov #100,r1\n mulu.w r1,r2\n sts macl,r1\n sub r1,r6\n bra bb_t\n mov #1,r4 ; (tens shown even if 0)\nbb_10:\n mov #0,r4\nbb_t:\n mov.w D_205,r1 ; tens = whole * 205 >> 11\n mulu.w r1,r6\n sts macl,r2\n shlr8 r2\n shlr2 r2\n shlr r2\n tst r2,r2\n bf bb_tp\n tst r4,r4\n bt bb_1\nbb_tp:\n mov r2,r0\n add r3,r0\n mov.w r0,@r5\n add #2,r5\nbb_1:\n mov #10,r1\n mulu.w r1,r2\n sts macl,r1\n sub r1,r6\n mov r6,r0\n add r3,r0\n mov.w r0,@r5\n mov #46,r0 ; '.'\n mov.w r0,@(2,r5)\n mov r7,r0\n add r3,r0\n mov.w r0,@(4,r5)\n mov #0,r0\n mov.w r0,@(6,r5)\n mov.l D_bpmbuf,r1 ; r0: 1 if three digits before the point\n sub r1,r5\n mov #4,r1\n cmp/hs r1,r5\n rts\n movt r0\n\n .align 4\nD_205: .word 205\n .word 0\nD_state: .long BI_STATE\nD_rows: .long ROWS\nD_rowsend: .long ROWS_END\nD_rowlen: .long ROW_LEN\nD_minw: .long MIN_W\nD_next: .long NEXT_DRAW\nD_mask: .long SLOTS - 1\nD_slots: .long SLOTS\nD_cols: .long COLS\nD_bpmbuf: .long BPMBUF\nD_bpmx: .long BPM_X\nD_bpmw: .long BPM_W\nD_keys: .long KEYS\nD_fpmask: .long 0xFFE7FFFF\nD_fnvb: .long 0x811C9DC5\nD_fnvp: .long 0x01000193\nD_div100: .long 0x51EB851F\n'''\n\n\ndef routine(prev_decoder, next_draw):\n h = hotcuekeys\n syms = {\n 'PREV_DECODER': prev_decoder, 'NEXT_DRAW': next_draw, 'BI_STATE': BI_STATE, 'USB_STATE': USB_STATE,\n 'TICK': h.TICK, 'STEP_TICKS': STEP_TICKS, 'SLOW_TICKS': SLOW_TICKS, 'BR_CTX': quicksearch.BR_CTX,\n 'QS_FREEZE': quicksearch.FREEZE, 'DEPTH': quicksearch.DEPTH, 'FCLOSE': FCLOSE, 'FREE': FREE, 'TABSIZE': SLOTS * 8,\n 'MALLOC': MALLOC, 'MEMSET': MEMSET, 'KEYS': KEYS, 'KEYSLEN': NKEYS * 16, 'NKEYS': NKEYS, 'PATH': PATH,\n 'MODE_R': MODE_R, 'FOPEN': FOPEN, 'PAGE': PAGE, 'PAGE_LEN': PAGE_LEN, 'FREAD': FREAD, 'FSEEK': FSEEK,\n 'MAX_PAGES': MAX_PAGES, 'SLOTS': SLOTS, 'ROWS': ROWS, 'ROWS_END': NROWS * ROW_LEN, 'ROW_LEN': ROW_LEN,\n 'MIN_W': MIN_W, 'COLS': COLS, 'DIGIT_W': DIGIT_W, 'BPMBUF': BI_STATE + 40, 'BPM_X': BPM_X, 'BPM_W': BPM_W, 'KEY_X': KEY_X,\n }\n return sh4asm.assemble(SOURCE, BI_CODE, syms)\n\n\ndef patch(app, stock):\n \"\"\"The application with BROWSE INFO: chained after the decoder literal\n and the text draw entry as it finds them (after played).\"\"\"\n h = hotcuekeys\n out = bytearray(app)\n word = lambda a: struct.unpack_from('> 16 if hi else val) & 0xFFFF\n return pred(p) | dn << 23 | cst << 7 | (0b11010 if hi else 0b01010) << 2 | ds << 1\n\n\ndef enc_d(op, data, base, off, p=''):\n \"\"\"ld/st *+base(off) (byte offset, scaled by the access size).\"\"\"\n ss, sn = reg(data)\n bs, bn = reg(base)\n sc = D_SCALE[op]\n assert off % sc == 0 and 0 <= off // sc < 32, (op, off)\n return pred(p) | sn << 23 | bn << 18 | (off // sc) << 13 | 0b0001 << 9 | bs << 7 | D_OPS[op] << 4 | 0b01 << 2 | ss << 1\n\n\ndef enc_b_imm(at, target, side=0, p=''):\n disp = (target - (at & ~31)) // 4\n assert -(1 << 20) <= disp < (1 << 20)\n return pred(p) | (disp & 0x1FFFFF) << 7 | 0b00100 << 2 | side << 1\n\n\ndef enc_b_reg(r, p=''):\n rs, rn = reg(r)\n return pred(p) | rn << 18 | (1 if rs == 0 else 0) << 12 | 0x362 # .S2 (X for an A register)\n\n\ndef enc_nop(n):\n assert 1 <= n <= 9\n return (n - 1) << 13\n\n\nDINT, RINT = 0x10004000, 0x10006000\n\n\ndef enc_shl(src, cst, dst, p=''):\n \"\"\"shl .S src,ucst5,dst\"\"\"\n ds, dn = reg(dst)\n ss, sn = reg(src)\n assert ss == ds and 0 <= cst < 32\n return pred(p) | dn << 23 | sn << 18 | cst << 13 | 0x32 << 6 | 0b1000 << 2 | ds << 1\n\n\ndef enc_dp(op, data, off, p=''):\n \"\"\"ld/st *+b14(ucst15) (byte offset, scaled), .D2\"\"\"\n ds, dn = reg(data)\n sc = D_SCALE[op]\n assert off % sc == 0 and 0 <= off // sc < 32768\n return pred(p) | dn << 23 | (off // sc) << 8 | 0 << 7 | D_OPS[op] << 4 | 0b11 << 2 | ds << 1\n\n\ndef enc_extu(src, csta, cstb, dst, p=''):\n \"\"\"extu .S src,csta,cstb,dst (field form, bits 7-6 = 00).\"\"\"\n ds, dn = reg(dst)\n ss, sn = reg(src)\n assert ss == ds\n return pred(p) | dn << 23 | sn << 18 | csta << 13 | cstb << 8 | 0b00 << 6 | 0b0010 << 2 | ds << 1\n\n\ndef enc_addaw(src2, src1, dst, p=''):\n \"\"\"addaw .D dst = src2 + src1*4 (src1 register or ucst5).\"\"\"\n ds, dn = reg(dst)\n s2s, s2n = reg(src2)\n assert s2s == ds\n if isinstance(src1, int):\n return pred(p) | dn << 23 | s2n << 18 | (src1 & 31) << 13 | 0x3A << 7 | 0b10000 << 2 | ds << 1\n s1s, s1n = reg(src1)\n return pred(p) | dn << 23 | s2n << 18 | s1n << 13 | 0x38 << 7 | 0b10000 << 2 | ds << 1\n\n\nclass Asm:\n def __init__(self, base):\n self.base, self.items, self.labels = base, [], {}\n\n def label(self, name):\n self.items.append(('label', name))\n\n def org(self, addr):\n \"\"\"continue at addr (a new block; the caller branches there)\"\"\"\n self.items.append(('org', addr))\n\n def op(self, mn, *a, p=''):\n self.items.append(('op', (mn, a, p)))\n\n def word(self, w):\n self.items.append(('word', w))\n\n def _enc(self, at, mn, a, p):\n if mn == 'mvk':\n return enc_mvk(0, a[0], a[1], p)\n if mn == 'mvkh':\n return enc_mvk(1, a[0], a[1], p)\n if mn == 'mvkl32': # helper: emitted as two words by assemble()\n raise AssertionError\n if mn in L_OPS:\n return enc_l(mn, a[0], a[1], a[2], p)\n if mn in D_OPS:\n return enc_d(mn, a[0], a[1], a[2], p)\n if mn == 'b':\n t = a[0]\n if isinstance(t, str) and t[0] in 'ab' and t[1:].isdigit():\n return enc_b_reg(t, p)\n t = self.labels[t] if isinstance(t, str) else t\n return enc_b_imm(at, t, a[1] if len(a) > 1 else 0, p)\n if mn == 'nop':\n return enc_nop(a[0] if a else 1)\n if mn == 'dint':\n return DINT\n if mn == 'rint':\n return RINT\n if mn == 'extu':\n return enc_extu(a[0], a[1], a[2], a[3], p)\n if mn == 'addaw':\n return enc_addaw(a[0], a[1], a[2], p)\n if mn == 'shl':\n return enc_shl(a[0], a[1], a[2], p)\n if mn == 'lddp': # ldbu/ldw/... *+b14(off)\n return enc_dp(a[0], a[1], a[2], p)\n if mn == 'mv':\n return enc_l('add', 0, a[0], a[1], p)\n raise KeyError(mn)\n\n def assemble(self):\n \"\"\"-> [(addr, word)]\"\"\"\n out = []\n for final in (False, True):\n pc, out = self.base, []\n for kind, arg in self.items:\n if kind == 'label':\n self.labels[arg] = pc\n continue\n if kind == 'org':\n pc = arg\n continue\n if kind == 'word':\n out.append((pc, arg))\n pc += 4\n continue\n mn, a, p = arg\n if mn == 'const': # mvk + mvkh of a 32-bit value\n v = self.labels.get(a[0], a[0]) if isinstance(a[0], str) else a[0]\n out.append((pc, enc_mvk(0, v if final or not isinstance(a[0], str) else 0, a[1], p)))\n out.append((pc + 4, enc_mvk(1, v if final or not isinstance(a[0], str) else 0, a[1], p)))\n pc += 8\n continue\n try:\n w = self._enc(pc, mn, a, p)\n except KeyError:\n if final:\n raise\n w = 0\n out.append((pc, w))\n pc += 4\n return out\n\n\ndef selftest():\n ref = [\n (enc_d('ldw', 'a4', 'a3', 0), 0x020c0264),\n (enc_d('stw', 'a3', 'a5', 0), 0x01940274),\n (enc_d('sth', 'a4', 'a3', 2), 0x020c2254),\n (enc_d('ldh', 'a4', 'a3', 6), 0x020c6244),\n (enc_d('ldhu', 'a4', 'a3', 0), 0x020c0204),\n (enc_l('cmpeq', 1, 'a4', 'a0'), 0x00102a58),\n (enc_l('or', 0, 'a4', 'a0'), 0x00100fd8),\n (enc_l('add', 'b10', 'b4', 'b6'), 0x0311407b & ~1),\n (enc_l('cmplt', 0, 'b4', 'b0'), 0x00100adb & ~1),\n (enc_l('cmpgt', 'a3', 'a10', 'a0'), 0x002868f8),\n (enc_l('sub', 'a3', 'a4', 'a10'), 0x051060f8),\n (enc_l('add', 'a4', 'a3', 'a3'), 0x018c8078),\n (enc_mvk(0, -7576, 'b4'), 0x0271342a),\n (enc_mvk(1, 0x1182e268, 'b4'), 0x0208c16a),\n (enc_b_reg('b4'), 0x00100362),\n (enc_addaw('a4', 'a6', 'a3'), 0x0190dc41 & ~1),\n (enc_nop(5), 0x00008000),\n (enc_shl('a14', 3, 'a8'), 0x04386ca1 & ~1),\n (enc_dp('ldbu', 'b6', 969), 0x0303c91e),\n ]\n bad = [(hex(a), hex(b)) for a, b in ref if a != b]\n assert not bad, bad\n return True\n\n\nif __name__ == '__main__':\n print('selftest', selftest())\n","mods/cdj900nxs/credit.py":"# SPDX-License-Identifier: GPL-2.0-or-later\n\"\"\"The mods' credit on the CDJ-900NXS 1.31 boot screen: \"Pionaarr Mods\"\nand the release (RELEASE, e.g. \"Pionaarr Mods 1.8.1\") where the splash\nshows \"Ver 1.31\". Our own; mods/patch_cdj900nxs.py\napplies it as `credit` (the patcher ticks it at the start).\n\nThe splash's text is made by 0x08BDCC14: a 50-byte buffer gets strcpy\n(0x08C28460) of the string the .data word at RAM 0x1110766C points to\n(image 0x08C6D22C, \"Ver \" at 0xA80D12BC), then strcat (the same function)\nof the version the getter 0x08BE9A8C returns (\"1.31\" at 0xA8000740), and is\nshown. The .data word now points at our text, and the function's own\nliteral of the getter (0x08BDCD8C, read only at 0x08BDCC34) at a stub that\nreturns an empty string, so nothing is added to it. The text's box (.data\n0x08C841E0: 139,363 - 619,385, right-aligned) is 8 lines taller, so the\ndescenders of p and y show. The getter itself and\neverything else that shows the version (the LINK screen's \"Ver %s\",\nUTILITY, the updater, the boot loader) are untouched.\"\"\"\nimport struct\n\nVERSION = '1.1.0' # Semantic Versioning: MAJOR.MINOR.PATCH\nRELEASE = '2.0.2' # the Pionaarr Mods release, ALWAYS the latest: the website's generator\n # (tools/make_builder_data.py) writes its version here\n\nBASE = 0x08000000\nDATA_WORD = 0x08C6D22C # .data: the splash's \"Ver \" pointer (RAM 0x1110766C)\nDATA_VER = 0xA80D12BC # \"Ver \"\nGETTER_LIT = 0x08BDCD8C # the splash function's literal of the version getter\nGETTER = 0x08BE9A8C\nTEXT = 'Pionaarr Mods ' + RELEASE\nCREDIT = 0x08FCF900 # between beatjump's 0x08FCF400..0x08FCF814 and cuecolours' 0x08FCFA00\nCREDIT_LEN = 0x40\nSTUB = CREDIT + 0x20 # mov.l @(4,pc),r0; rts; nop; nop; .long the text's final NUL\nBOX = 0x08C841E0 # .data: the splash text's box, x1 y1 x2 y2 (16 bits each)\nBOX_STOCK = (139, 363, 619, 385)\nBOX_NEW = (139, 363, 619, 393) # \"Ver 1.31\" has no descender; p and y need 8 more lines\n\n\ndef area():\n \"\"\"The credit area's bytes: the text, then the stub returning \"\".\"\"\"\n text = TEXT.encode('ascii') + b'\\0' # the splash takes bytes as Latin-1: no UTF-8\n # the splash's buffer is 50 bytes, its UTF-16 copy 100\n assert len(text) <= STUB - CREDIT and len(text) <= 50\n empty = CREDIT + len(text) - 1\n stub = struct.pack('<4HI', 0xD001, 0x000B, 0x0009, 0x0009, empty | 0xA0000000)\n return text.ljust(STUB - CREDIT, b'\\0') + stub\n\n\ndef patch(app, stock):\n \"\"\"The application with the credit; `stock` is the unmodified 1.31\n application, which every replaced byte is checked against.\"\"\"\n out = bytearray(app)\n end = CREDIT + CREDIT_LEN - BASE\n if len(out) < end:\n out += bytes(end - len(out))\n if any(out[CREDIT - BASE:end]):\n raise SystemExit('patch_cdj900nxs: credit: its area 0x%08x.. is not free' % CREDIT)\n\n def put(addr, before, after):\n off = addr - BASE\n if stock[off:off + 4] != struct.pack(' the 44-byte resource records\nTRI_ID = 0xC5 # the red memory-cue triangle, 16 x 5, RGB565\nTRI_PIXELS = 0x0815A1B0 # its pixels in the image\nTRI_RED = 0xF800\nMEMLIST = 0x0B7BE8D4 # the UI's memory list, 10 x 0x24\nOV_RECS = 0x0B800D9C # the overview's marker records, 12 bytes\nMK_RECS = 0x0B801258 # the marker records they come from, 16 bytes\nMK_RECORDS = 101\nMKCOPY_LIT = 0x08BC6BF8 # the waveform preparer's literal for memcpy, which fills MK_RECS\nMEMCPY = 0x08C279C4\nHOT_DEFAULT = 0x07E0 # a hot cue without a colour: green, as rekordbox's default\n\n# rekordbox's eight memory-cue colours (ids 1-8), as the player itself draws\n# them: the track-colour dots of the browser, resources 0x14, 0x16, 0x13,\n# 0x18, 0x12, 0x0F, 0x11 and 0x15 (RGB565 there).\nMEMORY_RGB565 = [\n 0xFA55, # 1 pink\n 0xF800, # 2 red\n 0xFC20, # 3 orange\n 0xFFE0, # 4 yellow\n 0x07E0, # 5 green\n 0x079F, # 6 aqua\n 0x22FF, # 7 blue\n 0x881F, # 8 purple\n]\n\n# hot cue letters A-H, 5 x 7, for the overview's bigger marker (bit 7 = left)\nLETTERS5 = [\n ['01110', '10001', '10001', '11111', '10001', '10001', '10001'],\n ['11110', '10001', '10001', '11110', '10001', '10001', '11110'],\n ['01110', '10001', '10000', '10000', '10000', '10001', '01110'],\n ['11110', '10001', '10001', '10001', '10001', '10001', '11110'],\n ['11111', '10000', '10000', '11110', '10000', '10000', '11111'],\n ['11111', '10000', '10000', '11110', '10000', '10000', '10000'],\n ['01110', '10001', '10000', '10111', '10001', '10001', '01111'],\n ['10001', '10001', '10001', '11111', '10001', '10001', '10001'],\n]\n\n# hot cue letters A-H, 3 x 5, rows top down: drawn black into a 9 x 5 marker\nLETTERS = ['010101111101101', '110101110101110', '011100100100011', '110101101101110',\n '111100110100111', '111100110100100', '011100101101011', '101101111101101']\n\n# data after the code (zero in the image)\nDATA = 0x08FD0000 # after the code (checked in patch())\nHOT_TABLE = DATA # 8 x 8: +0 time 1/150 s (-1 none), +4 RGB565, +6 hot cue number;\n # entry 0's +7 counts the loads (cue_get)\nSLOTS = 18 # triangles: memory list index 0-9, hot cues 10-17\nTRI_BUF = DATA + 0x40 # SLOTS x 160 bytes\nHOTBOX_W, HOTBOX_H = 16, 9 # the overview's hot cue marker: 11 x 9, then transparent; the\nHOTBOX_SIZE = 288 # blitter wants lines of a multiple of 16 bytes, as all the firmware's\nHOTBOX = (TRI_BUF + SLOTS * 160 + 31) & ~31 # 8 x HOTBOX_SIZE\nFAKE_RECS = HOTBOX + 8 * HOTBOX_SIZE # one 44-byte record, the detail waveform's\nDATA_END = FAKE_RECS + 44\nassert DATA_END <= CC_END\n\n\ndef rgb565(r, g, b):\n return (r & 0xF8) << 8 | (g & 0xFC) << 3 | b >> 3\n\n\nSOURCE = r'''\n; ---- cue_get: dbcl_GetUsbSdCueInfo(r4 connection, r5 track, r6 reply) plus colours\ncue_get:\n mov.l r8,@-r15\n mov.l r9,@-r15\n mov.l r10,@-r15\n mov.l r11,@-r15\n mov.l r12,@-r15\n mov.l r13,@-r15\n mov.l r14,@-r15\n sts.l pr,@-r15\n add #-20,r15 ; +0 wait's slot, +4/+8 message, +12 block, +16 size\n mov r4,r8\n mov r5,r9\n mov r6,r10\n mov.l K_cueinfo,r1\n jsr @r1\n nop\n mov r0,r12 ; the stock result, returned as it is\n mov.l K_hot,r1 ; no hot cues known\n mov #8,r2\n mov #-1,r3\ncg_clear:\n mov.l r3,@r1\n dt r2\n bf/s cg_clear\n add #8,r1\n mov.l K_hot,r1 ; one more load: entry 0's spare byte counts\n mov.b @(7,r1),r0 ; them (hotcuekeys reloads its slots on it)\n add #1,r0\n mov.b r0,@(7,r1)\n cmp/pl r12\n bf cg_early\n mov.l @r8,r11 ; the connection's socket side\n tst r11,r11\n bt cg_early\n mov.l K_check,r1\n jsr @r1\n mov r11,r4\n tst r0,r0\n bt cg_early\n mov.l K_alloc,r1\n jsr @r1\n mov #72,r4\n tst r0,r0\n bt cg_early\n mov.l r0,@(4,r15)\n mov.l r0,@(8,r15)\n mov #0,r1\n mov.l r1,@r15\n mov.l r1,@(12,r15)\n mov.l r1,@(16,r15)\n mov r8,r4\n mov r0,r5\n mov.l K_type,r6\n mov.l K_init,r1\n jsr @r1\n mov #8,r7 ; as dbcl_GetUsbSdCueInfo\n mov.l @(4,r15),r2\n mov.l r9,@(24,r2) ; the track\n mov #0,r1\n mov.l r1,@(28,r2)\n mov r11,r4\n mov.l @(8,r15),r5\n mov.l K_send,r1\n jsr @r1\n nop\n tst r0,r0\n bf cg_early\n mov r15,r1\n add #12,r1\n mov.l r1,@-r15 ; &block\n mov.l @(12,r15),r4 ; the message\n mov.l K_reply,r5\n mov r15,r6\n add #4,r6\n mov r15,r7\n mov.l K_wait,r1\n jsr @r1\n add #20,r7 ; &size\n add #4,r15\n mov.l @(12,r15),r13 ; the reply's entries\n tst r13,r13\n bt cg_early\n cmp/pz r0\n bf cg_free\n mov.l @(16,r15),r14\n add r13,r14 ; their end\n bra cg_entry\n nop\ncg_early:\n bra cg_out\n nop\ncg_entry:\n mov r13,r1\n add #16,r1\n cmp/hi r14,r1\n bt cg_free ; not even a header left\n mov.l @r13,r11 ; length\n mov #64,r1\n cmp/hs r1,r11\n bf cg_free\n mov r13,r1\n add r11,r1\n cmp/hi r14,r1\n bt cg_free ; runs past the end\n mov.l @(12,r13),r1 ; ms -> 1/150 s: ms * 3 / 20\n mov r1,r2\n add r1,r2\n add r1,r2\n mov.l K_div20,r1\n dmulu.l r1,r2\n sts mach,r9\n shlr2 r9\n shlr2 r9 ; r9 = time\n mov.b @(4,r13),r0\n extu.b r0,r6 ; r6 = hot cue number, 0 = memory cue\n tst r6,r6\n bf cg_hot\n mov #58,r0\n mov.b @(r0,r13),r0 ; colour id\n extu.b r0,r0\n tst r0,r0\n bt cg_next\n mov #8,r1\n cmp/hi r1,r0\n bt cg_next\n add r0,r0\n mov.l K_pal,r1\n add r1,r0\n mov.w @r0,r7\n bra cg_match\n extu.w r7,r7\ncg_hot:\n mov.l K_green,r7 ; no colour: rekordbox's default\n mov #82,r1 ; colour code, R, G, B, 2 bytes: 0x52 at least\n cmp/hs r1,r11\n bf cg_hstore\n mov #72,r0 ; the comment: its length in bytes at +0x48, text from +0x4A,\n mov.w @(r0,r13),r2 ; then 4 bytes, then colour code, R, G, B\n extu.w r2,r2 ; (the server's own entries: not checked against the length)\n add r13,r2\n add #78,r2\n mov.b @r2,r0 ; colour code; 0 = none\n tst r0,r0\n bt cg_hstore\n mov.b @(1,r2),r0 ; R\n extu.b r0,r7\n mov #-8,r0\n and r0,r7\n shll8 r7\n mov.b @(2,r2),r0 ; G\n extu.b r0,r0\n shlr2 r0\n shll2 r0\n shll r0\n shll2 r0\n or r0,r7\n mov.b @(3,r2),r0 ; B\n extu.b r0,r0\n shlr2 r0\n shlr r0\n or r0,r7\ncg_hstore:\n mov #9,r1 ; hot cues 1-8 into our table\n cmp/hs r1,r6\n bt cg_match\n mov r6,r1\n add #-1,r1\n shll2 r1\n shll r1\n mov.l K_hot,r2\n add r1,r2\n mov.l r9,@r2\n mov r7,r0\n mov.w r0,@(4,r2)\n mov r6,r0\n mov.b r0,@(6,r2)\ncg_match:\n ; mark the stock reply's entry with the same hot cue number and time\n mov.l @(24,r10),r1 ; entries\n tst r1,r1\n bt cg_next\n mov.l @(16,r10),r2\n mov.l @(20,r10),r3\n add r3,r2 ; memory + hot cue entries\n mov #16,r3\n cmp/hi r3,r2\n bf cg_m_ok\n mov r3,r2\ncg_m_ok:\n tst r2,r2\n bt cg_next\ncg_m:\n mov.b @(2,r1),r0\n extu.b r0,r0\n cmp/eq r6,r0\n bf cg_m_next\n mov.l @(12,r1),r0\n sub r9,r0 ; time difference, within one unit\n add #1,r0\n mov #2,r3\n cmp/hi r3,r0\n bt cg_m_next\n mov r7,r0\n mov.w r0,@(16,r1)\n mov r1,r3\n add #18,r3\n mov #1,r0\n mov.b r0,@r3\ncg_m_next:\n dt r2\n bf/s cg_m\n add #36,r1\ncg_next:\n bra cg_entry\n add r11,r13\ncg_free:\n mov.l @(12,r15),r4\n tst r4,r4\n bt cg_out\n mov.l K_free,r1\n jsr @r1\n nop\ncg_out:\n mov r12,r0\n add #20,r15\n lds.l @r15+,pr\n mov.l @r15+,r14\n mov.l @r15+,r13\n mov.l @r15+,r12\n mov.l @r15+,r11\n mov.l @r15+,r10\n mov.l @r15+,r9\n rts\n mov.l @r15+,r8\n\n .align 4\nK_alloc: .long 0x089A791E\nK_check: .long 0x089736F2\nK_cueinfo: .long CUEINFO\nK_div20: .long 0xCCCCCCCD\nK_free: .long 0x08A5EBC2\nK_green: .long HOT_DEFAULT\nK_hot: .long HOT_TABLE\nK_init: .long 0x08973C50\nK_pal: .long PALETTE\nK_reply: .long 0x00004E02\nK_send: .long 0x089738F0\nK_type: .long 0x00002B04\nK_wait: .long 0x08974198\n\n; ---- colour_for: r4 time (1/150 s), r5 tolerance -> r0 RGB565 or -1, r1 slot\ncolour_for:\n mov.l L_memlist,r1\n mov #0,r2 ; slot\ncf_loop:\n mov.l @r1,r0\n cmp/eq #-1,r0\n bt cf_hot\n mov #18,r0\n mov.b @(r0,r1),r0\n cmp/eq #1,r0\n bf cf_skip\n mov.l @(12,r1),r0\n sub r4,r0\n add r5,r0\n mov r5,r3\n add r5,r3\n cmp/hi r3,r0\n bt cf_skip\n mov.w @(16,r1),r0\n extu.w r0,r0\n rts\n mov r2,r1\ncf_skip:\n add #1,r2\n mov #10,r0\n cmp/hs r0,r2\n bf/s cf_loop\n add #36,r1\ncf_hot:\n mov.l L_hot,r1 ; then the hot cues: slots 10-17\n mov #10,r2\ncf_hloop:\n mov.l @r1,r0\n cmp/eq #-1,r0\n bt cf_hskip\n sub r4,r0\n add r5,r0\n mov r5,r3\n add r5,r3\n cmp/hi r3,r0\n bt cf_hskip\n mov.w @(4,r1),r0\n extu.w r0,r0\n rts\n mov r2,r1\ncf_hskip:\n add #1,r2\n mov #18,r0\n cmp/hs r0,r2\n bf/s cf_hloop\n add #8,r1\n rts\n mov #-1,r0\n\n; ---- make_tri: r4 slot, r5 RGB565 -> r0 its triangle (uncached address)\nmake_tri:\n mov r4,r0\n shll2 r0\n add r4,r0\n shll2 r0\n shll2 r0\n shll r0 ; slot * 160\n mov.l L_tribuf,r1\n add r0,r1 ; destination, through P2\n mov r1,r6\n mov #10,r0\n cmp/hs r0,r4\n bt mt_box\n mov.l L_tripix,r2\n mov.l L_red,r3\n mov #80,r7\nmt_loop:\n mov.w @r2+,r0\n extu.w r0,r0\n cmp/eq r3,r0\n bf mt_keep\n mov r5,r0\nmt_keep:\n mov.w r0,@r1\n dt r7\n bf/s mt_loop\n add #2,r1\n rts\n mov r6,r0\nmt_box:\n mov r4,r0 ; the letter, left-aligned in a word\n add #-10,r0\n shll2 r0\n mov.l L_font,r2\n mov.l @(r0,r2),r3\n mov.l L_key,r2 ; transparent\n mov #5,r7\nmb_row:\n mov #0,r4\nmb_col:\n mov #9,r0\n cmp/hs r0,r4\n bt mb_t ; past the marker\n mov #3,r0\n cmp/hs r0,r4\n bf mb_c\n mov #6,r0\n cmp/hs r0,r4\n bt mb_c\n shll r3 ; the letter's next pixel into T\n bf mb_c\n bra mb_st\n mov #0,r0 ; black\nmb_c:\n bra mb_st\n mov r5,r0\nmb_t:\n mov r2,r0\nmb_st:\n mov.w r0,@r1\n add #2,r1\n add #1,r4\n mov #16,r0\n cmp/hs r0,r4\n bf mb_col\n dt r7\n bf mb_row\n rts\n mov r6,r0\n\n; ---- mk_copy: memcpy(r4, r5, r6) for the waveform preparer; filling the\n; marker records, it adds the hot cues to them as memory-cue markers.\nmk_copy:\n mov.l r8,@-r15\n sts.l pr,@-r15\n mov r4,r8\n mov.l L_memcpy,r1\n jsr @r1\n nop\n mov.l L_mkrecs,r1\n cmp/eq r1,r8\n bf mk_out\n mov.l r0,@-r15 ; memcpy's result\n mov r8,r1\n mov #101,r2\n mov #-1,r3\n extu.b r3,r3 ; 0xff ends the list\nmk_find:\n mov.l @r1,r0\n cmp/eq r3,r0\n bt mk_add\n dt r2\n bf/s mk_find\n add #16,r1\n bra mk_done\n nop\nmk_add:\n mov.l L_hot,r3\n mov #8,r7\nmk_h:\n mov.l @r3,r0 ; time\n cmp/eq #-1,r0\n bt mk_hn\n tst r2,r2\n bt mk_done ; the list is full\n mov.l r0,@(8,r1)\n mov #0,r0\n mov.l r0,@r1 ; a memory cue\n mov.l r0,@(4,r1)\n mov #-1,r0\n mov.l r0,@(12,r1)\n add #16,r1\n add #-1,r2\nmk_hn:\n dt r7\n bf/s mk_h\n add #8,r3\nmk_done:\n mov.l @r15+,r0\nmk_out:\n lds.l @r15+,pr\n rts\n mov.l @r15+,r8\n\n; ---- det_res: the resource resolver, for the detail waveform (r9 = its column).\n; Every 0xC5 it is asked for becomes a 16 x 8 marker of ours, as the renderer\n; (patched) copies 11 x 8: a memory cue's triangle in rows 3-7 (coloured, or\n; the stock red one), a hot cue's box with its letter in rows 0-7.\ndet_res:\n mov.l L_resolve,r1\n mov.l L_triid,r0\n cmp/eq r0,r4\n bt dr_mine\n jmp @r1\n nop\ndr_mine:\n mov.l r8,@-r15\n mov.l r9,@-r15\n mov.l r10,@-r15\n mov.l r11,@-r15\n sts.l pr,@-r15\n mov r9,r8\n jsr @r1\n nop\n mov r0,r10 ; the record\n tst r10,r10\n bt dr_out\n mov r8,r4\n bsr colour_for\n mov #16,r5 ; zoomed out, a column stands for up to 16\n mov r1,r9 ; slot\n cmp/eq #-1,r0\n bt dr_plain\n mov r0,r5\n mov r9,r4\n mov #10,r2\n cmp/hs r2,r4\n bt dr_hot\n bsr make_tri\n nop\n mov #3,r11 ; triangle: rows 3-7\n bra dr_copy\n mov #5,r6\ndr_hot:\n bsr make_hotbox\n nop\n mov #0,r11 ; box: rows 0-7\n bra dr_copy\n mov #8,r6\ndr_plain:\n mov #18,r9 ; no colour: the stock triangle\n mov.l L_tripix,r0\n mov #3,r11\n mov #5,r6\ndr_copy:\n mov r0,r3 ; source, 16 pixels a line\n mov.l L_detbuf,r2\n mov r9,r0\n shll8 r0\n add r0,r2\n mov r2,r8 ; this slot's 16 x 8\n mov.l L_key,r0\n mov #64,r7\n shll r7\n mov r2,r1\ndr_fill:\n mov.w r0,@r1\n dt r7\n bf/s dr_fill\n add #2,r1\n mov r11,r0\n shll2 r0\n shll2 r0\n shll r0\n add r0,r2\ndr_row:\n mov #16,r7\ndr_px:\n mov.w @r3+,r0\n mov.w r0,@r2\n dt r7\n bf/s dr_px\n add #2,r2\n dt r6\n bf dr_row\n mov.l L_fake,r2 ; the record, with our size and pixels\n mov r10,r3\n mov #11,r4\ndr_rec:\n mov.l @r3+,r1\n mov.l r1,@r2\n dt r4\n bf/s dr_rec\n add #4,r2\n add #-44,r2\n mov.l L_detsize,r1\n mov.l r1,@(4,r2)\n mov.l r8,@(12,r2)\n mov r2,r10\ndr_out:\n mov r10,r0\n lds.l @r15+,pr\n mov.l @r15+,r11\n mov.l @r15+,r10\n mov.l @r15+,r9\n rts\n mov.l @r15+,r8\n\n; ---- ov_draw: draw_bitmap(r4, r5 x, r6 y, r7 resource) for the overview (r13 = its record)\nov_draw:\n mov.l L_draw,r1\n mov.l L_triid,r0\n cmp/eq r0,r7\n bt od_mine\n jmp @r1\n nop\nod_mine:\n mov.l r13,@-r15\n mov.l r8,@-r15\n mov.l r9,@-r15\n mov.l r10,@-r15\n mov.l r11,@-r15\n mov.l r12,@-r15\n mov.l r14,@-r15\n sts.l pr,@-r15\n mov r4,r8\n mov r5,r9\n mov r6,r10\n mov r7,r11\n mov.l L_ovrecs,r1 ; which record: 12 bytes each, 16 in the other list\n mov r13,r2\n sub r1,r2\n mov #0,r3\n mov #101,r4\nod_idx:\n cmp/pl r2\n bf od_found\n add #-12,r2\n dt r4\n bf/s od_idx\n add #16,r3\n bra od_plain\n nop\nod_found:\n tst r2,r2\n bf od_plain ; not on a record\n mov.l L_mkrecs,r1\n add r3,r1\n mov.l @(8,r1),r4\n bsr colour_for\n mov #0,r5\n cmp/eq #-1,r0\n bt od_plain\n mov r1,r4\n mov #10,r2\n cmp/hs r2,r4\n bt od_hot\n bsr make_tri\n mov r0,r5\n mov.l L_trisize,r13 ; 16 x 5, the triangle's own size\n bra od_pix\n nop\nod_hot:\n bsr make_hotbox ; a hot cue: the bigger box\n mov r0,r5\n mov.l L_boxsize,r13\nod_pix:\n mov.l L_restab,r1 ; the triangle's record\n mov.l @r1,r12\n mov.l L_trirec,r1\n add r1,r12\n mov.l @(32,r12),r14 ; its pixel offset and size, put back below\n mov.l @(4,r12),r1\n mov.l r13,@(4,r12)\n mov r1,r13\n mov.l L_p0mask,r1 ; the blitter gets the plain address\n and r1,r0\n mov.l L_imgbase,r1\n sub r1,r0\n mov.l r0,@(32,r12)\n mov r8,r4\n mov r9,r5\n mov r10,r6\n mov.l L_draw,r1\n jsr @r1\n mov r11,r7\n mov.l r13,@(4,r12)\n bra od_out\n mov.l r14,@(32,r12)\nod_plain:\n mov r8,r4\n mov r9,r5\n mov r10,r6\n mov.l L_draw,r1\n jsr @r1\n mov r11,r7\nod_out:\n lds.l @r15+,pr\n mov.l @r15+,r14\n mov.l @r15+,r12\n mov.l @r15+,r11\n mov.l @r15+,r10\n mov.l @r15+,r9\n mov.l @r15+,r8\n rts\n mov.l @r15+,r13\n\n .align 4\nL_cueinfo: .long CUEINFO\nL_check: .long 0x089736F2\nL_alloc: .long 0x089A791E\nL_init: .long 0x08973C50\nL_send: .long 0x089738F0\nL_wait: .long 0x08974198\nL_free: .long 0x08A5EBC2\nL_type: .long 0x00002B04\nL_reply: .long 0x00004E02\nL_div20: .long 0xCCCCCCCD\nL_hot: .long HOT_TABLE\nL_memlist: .long MEMLIST\nL_tribuf: .long TRI_BUF_P2\nL_tripix: .long TRI_PIXELS\nL_red: .long TRI_RED\nL_resolve: .long RESOLVE\nL_draw: .long DRAW\nL_triid: .long TRI_ID\nL_fake: .long FAKE_RECS\nL_detbuf: .long DET_BUF\nL_detsize: .long 0x00080010\nL_ovrecs: .long OV_RECS\nL_mkrecs: .long MK_RECS\nL_restab: .long RES_TABLE_PTR\nL_trirec: .long TRI_REC_OFF\nL_imgbase: .long 0x08100000\nL_p0mask: .long 0x1FFFFFFF\nL_pal: .long PALETTE\nL_green: .long HOT_DEFAULT\nL_font: .long FONT\nL_key: .long 0xF81F\nL_memcpy: .long MEMCPY\nL_trisize: .long 0x00050010\nL_boxsize: .long BOXSIZE\n\n; ---- make_hotbox: r4 slot (10-17), r5 RGB565 -> r0 the overview's hot cue\n; marker, 11 x 9 in its colour with the letter in black (uncached address)\nmake_hotbox:\n mov.l r8,@-r15\n mov.l r9,@-r15\n mov r4,r6\n add #-10,r6 ; 0 = A\n mov r6,r1 ; HOTBOX_SIZE (288) * index\n shll8 r1\n mov r6,r2\n shll2 r2\n shll2 r2\n shll r2\n add r2,r1\n mov.l M_hotbox,r2\n add r2,r1\n mov r1,r9 ; returned\n mov r6,r2 ; its letter: 7 bytes from FONT5 + 7 * index\n shll2 r2\n shll r2\n sub r6,r2\n mov.l M_font5,r3\n add r2,r3\n mov.l M_key,r2\n mov #0,r6 ; row\nhb_row:\n mov #0,r4 ; the letter's bits in this row\n mov r6,r0\n cmp/eq #0,r0\n bt hb_cols\n cmp/eq #8,r0\n bt hb_cols\n add #-1,r0\n mov.b @(r0,r3),r4\n extu.b r4,r4\nhb_cols:\n mov #0,r8 ; column\nhb_col:\n mov #11,r0\n cmp/hs r0,r8\n bt hb_t\n mov #3,r0\n cmp/hs r0,r8\n bf hb_c\n mov #8,r0\n cmp/hs r0,r8\n bt hb_c\n mov r4,r0\n tst #128,r0\n bt/s hb_c\n shll r4\n bra hb_st\n mov #0,r0 ; black\nhb_c:\n bra hb_st\n mov r5,r0\nhb_t:\n mov r2,r0\nhb_st:\n mov.w r0,@r1\n add #2,r1\n add #1,r8\n mov #16,r0\n cmp/hs r0,r8\n bf hb_col\n add #1,r6\n mov #9,r0\n cmp/hs r0,r6\n bf hb_row\n mov r9,r0\n mov.l @r15+,r9\n rts\n mov.l @r15+,r8\n\n .align 4\nM_hotbox: .long HOTBOX_P2\nM_font5: .long FONT5\nM_key: .long 0xF81F\nFONT:\n'''\n\n\ndef routine():\n \"\"\"The code at CC_BASE, the memory-cue palette after it, and the labels.\"\"\"\n syms = {\n 'CUEINFO': CUEINFO, 'RESOLVE': RESOLVE, 'DRAW': DRAW, 'HOT_TABLE': HOT_TABLE,\n 'MEMLIST': MEMLIST, 'TRI_BUF_P2': TRI_BUF | 0xA0000000, 'TRI_PIXELS': TRI_PIXELS,\n 'TRI_RED': TRI_RED, 'TRI_ID': TRI_ID, 'FAKE_RECS': FAKE_RECS, 'OV_RECS': OV_RECS,\n 'MK_RECS': MK_RECS, 'RES_TABLE_PTR': RES_TABLE_PTR, 'TRI_REC_OFF': TRI_ID * 44,\n 'HOT_DEFAULT': HOT_DEFAULT, 'MEMCPY': MEMCPY, 'HOTBOX_P2': HOTBOX | 0xA0000000,\n 'BOXSIZE': HOTBOX_W | HOTBOX_H << 16, 'DET_BUF': DET_BUF,\n }\n font = b''.join(struct.pack(' r0 the named cue to show (CN_TABLE entry) or 0; r1-r7 used\ncn_pick:\n mov.l P_hot,r6\n mov.b @(7,r6),r0 ; the table is this load's?\n mov.l P_load,r1\n mov.b @r1,r1\n cmp/eq r1,r0\n bf pk_none\n mov.l P_count,r1\n mov.l @r1,r3\n tst r3,r3\n bt pk_none\n mov.l P_pos,r1\n mov.l @r1,r4\n mov.l P_behind,r1\n sub r1,r4 ; from a second behind\n mov.l P_table,r2\n mov #0,r0 ; best so far\npk_loop:\n mov.l @r2,r1 ; ms\n cmp/ge r4,r1\n bf pk_next ; behind\n mov.l @(8,r2),r5 ; a hot cue still where it was?\n tst r5,r5\n bt pk_ok\n mov #9,r7\n cmp/hs r7,r5\n bt pk_next\n add #-1,r5\n shll2 r5\n shll r5\n add r6,r5\n mov.l @r5,r5 ; HOT_TABLE's time, 1/150 s\n mov.l @(4,r2),r7\n sub r7,r5\n add #1,r5\n mov #2,r7\n cmp/hi r7,r5\n bt pk_next\npk_ok:\n tst r0,r0\n bt pk_take\n mov.l @r0,r7\n cmp/ge r7,r1\n bt pk_next ; not nearer\npk_take:\n mov r2,r0\npk_next:\n dt r3\n bf/s pk_loop\n add #64,r2\n rts\n nop\npk_none:\n rts\n mov #0,r0\n\n; ---- cn_draw: the text widget's draw method (r4 renderer, r5 widget)\ncn_draw:\n mov.l r8,@-r15\n mov.l r9,@-r15\n mov.l r10,@-r15\n mov.l r11,@-r15\n sts.l pr,@-r15\n mov r4,r8\n mov r5,r9\n mov.l @(4,r5),r1 ; the title?\n mov.l D_title,r2\n cmp/eq r2,r1\n bf dr_plain\n mov.l D_depth,r1 ; BROWSE closed?\n mov.b @r1,r1\n tst r1,r1\n bf dr_plain\n mov.l D_play,r1 ; a track loaded? (the UI's play state: 0 none, also once the\n mov.l @r1,r1 ; track's medium is gone and the title reads \"Not Loaded.\")\n tst r1,r1\n bt dr_plain\n mov.l @(40,r9),r1 ; the title white? (dimmed behind a popup, as MENU's: no name)\n mov #-1,r2\n cmp/eq r2,r1\n bf dr_plain\n bsr cn_pick\n nop\n tst r0,r0\n bt dr_plain\n mov r0,r10 ; the cue\n mov.l D_label,r2 ; the label: \"A \" for a hot cue, then the name\n mov.l @(8,r10),r1\n tst r1,r1\n bt dr_name\n add #64,r1 ; 'A' - 1 + number\n mov r1,r0\n mov.w r0,@r2\n mov #32,r0\n mov.w r0,@(2,r2)\n add #4,r2\ndr_name:\n mov r10,r1\n add #16,r1\ndr_ncopy:\n mov.w @r1+,r0\n mov.w r0,@r2\n tst r0,r0\n bf/s dr_ncopy\n add #2,r2\n mov.l @(28,r9),r11 ; the title, narrowed\n mov r11,r1\n mov.l D_hmask,r2\n and r2,r1\n mov.l D_tw,r2\n or r2,r1\n mov.l r1,@(28,r9)\n mov r8,r4\n mov r9,r5\n mov.l D_next,r1\n jsr @r1\n nop\n mov.l r11,@(28,r9)\n mov.l D_clone,r2 ; the copy: our place, text, colour\n mov r9,r1\n mov #24,r3\ndr_clone:\n mov.l @r1+,r0\n mov.l r0,@r2\n dt r3\n bf/s dr_clone\n add #4,r2\n mov.l D_clone,r5\n mov.l @(24,r9),r1 ; y stays, x ours\n mov.l D_hmask,r2\n and r2,r1\n mov.l D_lx,r2\n or r2,r1\n mov.l r1,@(24,r5)\n mov r11,r1\n mov.l D_hmask,r2\n and r2,r1\n mov.l D_lw,r2\n or r2,r1\n mov.l r1,@(28,r5)\n mov.l @(12,r10),r1\n mov.l r1,@(40,r5)\n mov.l D_label,r1\n mov.l r1,@(52,r5)\n mov r8,r4\n mov.l D_next,r1\n jsr @r1\n nop\n bra dr_out\n nop\ndr_plain:\n mov r8,r4\n mov r9,r5\n mov.l D_next,r1\n jsr @r1\n nop\ndr_out:\n lds.l @r15+,pr\n mov.l @r15+,r11\n mov.l @r15+,r10\n mov.l @r15+,r9\n rts\n mov.l @r15+,r8\n\n .align 4\nP_behind: .long BEHIND_MS\nP_count: .long CN_COUNT\nP_hot: .long HOT_TABLE\nP_load: .long CN_LOAD\nP_pos: .long POS_MS\nP_table: .long CN_TABLE\nD_clone: .long CN_CLONE\nD_depth: .long BROWSE_DEPTH\nD_play: .long UI_PLAY\nD_hmask: .long 0xFFFF0000\nD_label: .long CN_LABEL\nD_lw: .long LABEL_W\nD_lx: .long LABEL_X\nD_next: .long NEXT_DRAW\nD_title: .long TITLE_ID\nD_tw: .long TITLE_W\nMEMORY_TAB:\n'''\n\n\ndef routine(next_draw):\n src = SOURCE + ''.join(' .long 0x%08X\\n' % c for c in MEMORY_ABGR)\n return sh4asm.assemble(src, CN_CODE, {\n 'CN_COUNT': CN_COUNT, 'CN_LOAD': CN_LOAD, 'CN_TABLE': CN_TABLE, 'CN_LABEL': CN_LABEL,\n 'CN_CLONE': CN_CLONE, 'CN_MAX': CN_MAX, 'CN_NAME': CN_NAME, 'FREE': FREE,\n 'HOT_TABLE': HOT_TABLE, 'POS_MS': POS_MS, 'BROWSE_DEPTH': BROWSE_DEPTH, 'UI_PLAY': UI_PLAY,\n 'TITLE_ID': TITLE_ID, 'TITLE_W': TITLE_W, 'LABEL_X': LABEL_X, 'LABEL_W': LABEL_W,\n 'BEHIND_MS': BEHIND_MS, 'NO_COLOUR': NO_COLOUR, 'NEXT_DRAW': next_draw})\n\n\ndef patch(app, stock):\n \"\"\"The application with CUE NAMES added (after cuecolours and, if chosen,\n keynotation); `stock` is the unmodified 1.31 application.\"\"\"\n out = bytearray(app)\n word = lambda a: struct.unpack_from(' +0x13C on (1/2) or 0 off, +0x140 num, +0x144 den): the same num/den\n again turns it off, another one switches. SLIP's flag 0x0AF3AF24.\n * dh_poll runs after the panel decoder (and the mods chained there, so it\n sees no key that hotcuekeys keeps for its hot cues): a key held at least\n HOLD_TICKS whose press turned its divide on (or switched to it) is\n pressed once more for the UI when it is let go, as decoded bit for a few\n polls (INJ_AT..INJ_END after the release): the stock handler turns it\n off, or, when another divide was on before the press, switches back to\n that one. A short press stays stock; a second key pressed while one is\n held leaves both stock.\n * UTILITY gets one more item, DIVIDE HOLD (OFF / ON, ON until chosen),\n kept in the settings journal as SAVE_ID like LED ANIMATION.\n\"\"\"\nimport os\nimport struct\nimport sys\n\nsys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))\nimport sh4asm # noqa: E402\nimport hotcuekeys # noqa: E402\n\nVERSION = '0.1.0' # Semantic Versioning: MAJOR.MINOR.PATCH\n\nBASE = 0x08000000\nDH_BASE = 0x08FE8000 # after widewave's 0x08FE5000..0x08FE8000\nDH_END = 0x08FE8800\nDH_STATE = DH_BASE # bytes: +0 setting (DEFAULT until a choice is saved), +1 setting read,\n # +2 the key held (its bit), +3 the key being pressed for the UI;\n # words: +4 press tick, +8 injection tick, +12 last keys,\n # +16/+20/+24 the divide before the press (on, num, den)\nDEFAULT = 1\nDH_CODE = DH_BASE + 0x20\n\nKEYS = 0x0B2E82CE # decoded BEAT DIVIDE bits\nKEY_MASK = 0xF8\nDIVIDES = ((0x80, 3, 4), (0x40, 1, 3), (0x20, 1, 2), (0x10, 1, 4), (0x08, 1, 8))\nSLIP_FLAG = 0x0AF3AF24 # != 0: SLIP on (the keys are its slip loop)\nPLAYER_CTX = 0x099445DC # +0x20 -> the loaded track's record\nDIV_ON = 0x13C # ... +0x13C on, +0x140 num, +0x144 den\nHOLD_TICKS = 50 # 0.5 s held: only until let go\nINJ_AT = 2 # the press for the UI 20 ms after the release\nINJ_END = 7 # ... held 50 ms\nSAVE_ID = 0x83E8 # ours (hotcuekeys 0x83E1, beatjump 0x83E2, keynotation 0x83E3, usbautoload\n # 0x83E4, advanced_waveforms 0x83E5, phasemeter 0x83E6, ledsaver 0x83E7)\nLABEL = 'DIVIDE HOLD'\n\nSOURCE = r'''\n; ---- dh_poll: the panel decoder (or whatever ran there), then the keys\ndh_poll:\n sts.l pr,@-r15\n mov.l D_prev,r0\n jsr @r0\n nop\n mov.l r0,@-r15 ; the decoder's result, returned as it is\n mov.l r8,@-r15\n mov.l r9,@-r15\n mov.l D_state,r8\n mov.b @(1,r8),r0\n tst r0,r0\n bf dp_loaded\n bsr dh_load\n nop\ndp_loaded:\n mov.l D_keys,r1\n mov.b @r1,r9\n extu.b r9,r9\n mov #-8,r0 ; KEY_MASK 0xF8\n extu.b r0,r0\n and r0,r9 ; r9 = the divide keys down now (before ours)\n mov.b @r8,r0\n tst r0,r0\n bf dp_on\n mov #0,r0 ; OFF: nothing held, nothing pressed\n mov.b r0,@(2,r8)\n bra dp_keep\n mov.b r0,@(3,r8)\ndp_on:\n mov.b @(3,r8),r0 ; our press for the UI under way?\n tst r0,r0\n bt dp_slip\n mov r0,r3\n extu.b r3,r3\n mov.l D_tick,r2\n mov.l @r2,r2\n mov.l @(8,r8),r0\n sub r0,r2 ; ticks since the release\n mov #INJ_END,r0\n cmp/hs r0,r2\n bf dp_inj\n mov #0,r0 ; done\n bra dp_slip\n mov.b r0,@(3,r8)\ndp_inj:\n mov #INJ_AT,r0\n cmp/hs r0,r2\n bf dp_slip\n mov.l D_keys,r1 ; the key down for the UI\n mov.b @r1,r0\n or r3,r0\n mov.b r0,@r1\ndp_slip:\n mov.l D_slip,r1\n mov.l @r1,r0\n tst r0,r0\n bt dp_edges\n mov #0,r0 ; SLIP: stock\n bra dp_keep\n mov.b r0,@(2,r8)\ndp_edges:\n mov.l @(12,r8),r4 ; the keys last time\n mov r4,r5\n not r5,r5\n and r9,r5 ; r5 = pressed now\n mov r9,r6\n not r6,r6\n and r4,r6 ; r6 = let go now\n mov.b @(2,r8),r0\n extu.b r0,r7 ; r7 = the key held\n tst r7,r7\n bt dp_free\n tst r5,r5 ; another key pressed meanwhile: stock\n bt dp_still\n mov #0,r0\n bra dp_keep\n mov.b r0,@(2,r8)\ndp_still:\n tst r6,r7\n bt dp_keep ; still held\n mov #0,r0\n mov.b r0,@(2,r8)\n mov.b @(3,r8),r0 ; (a press for the UI still under way)\n tst r0,r0\n bf dp_keep\n mov.l D_tick,r2\n mov.l @r2,r2\n mov.l @(4,r8),r0\n sub r0,r2\n mov #HOLD_TICKS,r0\n cmp/hs r0,r2\n bf dp_keep ; a short press: stock\n bsr dh_release\n mov r7,r4\n bra dp_keep\n nop\ndp_free:\n tst r5,r5\n bt dp_keep\n mov.b @(3,r8),r0\n tst r0,r0\n bf dp_keep\n mov r5,r0 ; exactly one key pressed\n mov r5,r1\n add #-1,r1\n tst r1,r0\n bf dp_keep\n mov.l D_ctx,r1 ; a track loaded\n mov.l @(32,r1),r1\n tst r1,r1\n bt dp_keep\n mov.l D_on,r0 ; the divide before the press\n mov.l @(r0,r1),r2\n mov.l r2,@(16,r8)\n add #4,r0\n mov.l @(r0,r1),r2\n mov.l r2,@(20,r8)\n add #4,r0\n mov.l @(r0,r1),r2\n mov.l r2,@(24,r8)\n mov.l D_tick,r2\n mov.l @r2,r2\n mov.l r2,@(4,r8)\n mov r5,r0\n mov.b r0,@(2,r8)\ndp_keep:\n mov.l r9,@(12,r8)\n mov.l @r15+,r9\n mov.l @r15+,r8\n mov.l @r15+,r0\n lds.l @r15+,pr\n rts\n nop\n\n; ---- dh_release: r4 = the key let go after HOLD_TICKS, r8 = the state. Its\n; divide on: pressed once more for the UI (off), or the key of the divide on\n; before the press (back to that one)\ndh_release:\n mov.l D_ctx,r1\n mov.l @(32,r1),r1\n tst r1,r1\n bt dr_out\n mov.l D_on,r0\n mov.l @(r0,r1),r2\n tst r2,r2\n bt dr_out ; off already\n add #4,r0\n mov.l @(r0,r1),r6 ; num\n add #4,r0\n mov.l @(r0,r1),r7 ; den\n mov.l D_divs,r2 ; this key's num/den\n mov #NDIVS,r3\ndr_find:\n mov.l @r2,r0\n cmp/eq r4,r0\n bt dr_found\n dt r3\n bf/s dr_find\n add #12,r2\n bra dr_out\n nop\ndr_found:\n mov.l @(4,r2),r0\n cmp/eq r6,r0\n bf dr_out ; another divide on now\n mov.l @(8,r2),r0\n cmp/eq r7,r0\n bf dr_out\n mov.l @(16,r8),r0 ; before the press: another divide on?\n tst r0,r0\n bt dr_press\n mov.l @(20,r8),r6\n mov.l @(24,r8),r7\n mov.l @(4,r2),r0\n cmp/eq r6,r0\n bf dr_back\n mov.l @(8,r2),r0\n cmp/eq r7,r0\n bt dr_press\ndr_back:\n mov.l D_divs,r2 ; its key\n mov #NDIVS,r3\ndr_bfind:\n mov.l @(4,r2),r0\n cmp/eq r6,r0\n bf dr_bnext\n mov.l @(8,r2),r0\n cmp/eq r7,r0\n bf dr_bnext\n bra dr_press\n mov.l @r2,r4\ndr_bnext:\n dt r3\n bf/s dr_bfind\n add #12,r2\ndr_press:\n mov r4,r0\n mov.b r0,@(3,r8)\n mov.l D_tick,r2\n mov.l @r2,r2\n mov.l r2,@(8,r8)\ndr_out:\n rts\n nop\n\n; ---- dh_show: the item's +28, SCREEN SAVER's with our value in place of its getter's\ndh_show:\n mov.l @(16,r4),r0\n cmp/eq #-1,r0\n bt dw_ours\n mov.l D_show,r1\n jmp @r1\n nop\ndw_ours:\n mov.l r8,@-r15\n sts.l pr,@-r15\n mov r4,r8\n mov.l D_state,r1\n mov.b @r1,r0\n extu.b r0,r0\n mov.l r0,@(16,r4) ; shown as if being chosen\n mov.l D_show,r1\n jsr @r1\n nop\n mov.l D_state,r1\n mov.b @r1,r1\n extu.b r1,r1\n mov.l r1,@(12,r8)\n mov #-1,r1\n mov.l r1,@(16,r8)\n lds.l @r15+,pr\n rts\n mov.l @r15+,r8\n\n; ---- dh_take: the item's +40, a chosen value taken (as SCREEN SAVER's)\ndh_take:\n mov.l @(16,r4),r5\n mov.w @(8,r4),r0\n extu.w r5,r6\n extu.w r0,r2\n cmp/ge r2,r6\n bt dt_none\n mov.l @(12,r4),r2\n cmp/eq r2,r5\n bt dt_none\n mov.l r5,@(12,r4)\n mov.l D_state,r1\n mov r5,r0\n mov.b r0,@r1\n sts.l pr,@-r15\n bsr dh_save ; into the flash journal\n mov r5,r4\n lds.l @r15+,pr\n rts\n mov #1,r0\ndt_none:\n rts\n mov #0,r0\n\n; ---- dh_save: r4 = value, sent to the Backup task as setting SAVE_ID (type 5)\ndh_save:\n mov.l r8,@-r15\n mov.l r9,@-r15\n sts.l pr,@-r15\n add #-4,r15\n mov r4,r8\n mov.l D_pool,r1\n mov.l @r1,r4\n mov r15,r5\n mov #0,r6\n mov.l D_getblk,r1\n jsr @r1\n nop\n tst r0,r0\n bf dv_out\n mov.l @r15,r9\n tst r9,r9\n bt dv_out\n mov r9,r4\n mov #0,r5\n mov #-116,r6\n mov.l D_memset,r1\n jsr @r1\n extu.b r6,r6 ; 0x8C bytes\n mov #5,r0\n mov.b r0,@(4,r9)\n mov.l D_saveid,r0\n mov.w r0,@(8,r9)\n mov r8,r0\n mov.w r0,@(10,r9)\n mov.l D_mbx,r1\n mov.l @r1,r4\n mov r9,r5\n mov.l D_send,r1\n jsr @r1\n nop\n tst r0,r0\n bt dv_out\n mov.l D_pool,r1 ; not taken: give the block back\n mov.l @r1,r4\n mov r9,r5\n mov.l D_release,r1\n jsr @r1\n nop\ndv_out:\n add #4,r15\n lds.l @r15+,pr\n mov.l @r15+,r9\n rts\n mov.l @r15+,r8\n\n; ---- dh_load: r8 -> the state; the last SAVE_ID in the journal, if any\ndh_load:\n mov #1,r0\n mov.b r0,@(1,r8)\n mov.l D_journal,r2\n mov.l D_jend,r3\n mov.l D_saveid,r5\n mov #-1,r6\n extu.w r6,r6\ndl_loop:\n cmp/hs r3,r2\n bt dl_out\n mov.w @r2,r0\n extu.w r0,r0\n cmp/eq r6,r0 ; erased: the end\n bt dl_out\n cmp/eq r5,r0\n bf dl_next\n mov.w @(2,r2),r0\n and #1,r0\n mov.b r0,@r8\ndl_next:\n bra dl_loop\n add #4,r2\ndl_out:\n rts\n nop\n\n .align 4\nD_prev: .long PREV_DECODER\nD_state: .long DH_STATE\nD_keys: .long KEYS\nD_tick: .long TICK\nD_slip: .long SLIP_FLAG\nD_ctx: .long PLAYER_CTX\nD_on: .long DIV_ON\nD_divs: .long DIVS\nD_show: .long SHOW_SAVER\nD_pool: .long BACKUP_POOL\nD_mbx: .long BACKUP_MBX\nD_getblk: .long GET_BLOCK\nD_send: .long SEND\nD_release: .long RELEASE\nD_memset: .long MEMSET\nD_saveid: .long SAVE_ID\nD_journal: .long JOURNAL\nD_jend: .long JOURNAL_END\n'''\n\n\ndef divs():\n \"\"\"DIVS: (bit, num, den) words per key.\"\"\"\n return b''.join(struct.pack('<3I', *d) for d in DIVIDES)\n\n\ndef routine(prev_decoder):\n \"\"\"(code, labels) at DH_CODE, then DIVS, our label, the UTILITY items.\"\"\"\n h = hotcuekeys\n syms = {\n 'PREV_DECODER': prev_decoder, 'DH_STATE': DH_STATE, 'KEYS': KEYS, 'KEY_MASK': KEY_MASK,\n 'TICK': h.TICK, 'SLIP_FLAG': SLIP_FLAG, 'PLAYER_CTX': PLAYER_CTX, 'DIV_ON': DIV_ON, 'DIVS': 0,\n 'NDIVS': len(DIVIDES), 'HOLD_TICKS': HOLD_TICKS, 'INJ_AT': INJ_AT, 'INJ_END': INJ_END,\n 'SHOW_SAVER': h.SHOW_SAVER, 'BACKUP_POOL': h.BACKUP_POOL, 'BACKUP_MBX': h.BACKUP_MBX,\n 'GET_BLOCK': h.GET_BLOCK, 'SEND': h.SEND, 'RELEASE': h.RELEASE, 'MEMSET': h.MEMSET,\n 'SAVE_ID': SAVE_ID, 'JOURNAL': h.JOURNAL, 'JOURNAL_END': h.JOURNAL + h.JOURNAL_LEN,\n }\n code, labels = sh4asm.assemble(SOURCE, DH_CODE, syms)\n at = (DH_CODE + len(code) + 3) & ~3\n labels['DIVS'] = at\n at += len(divs())\n labels['LABEL'] = at\n at += 2 * len(LABEL) + 2\n labels['ITEMS'] = (at + 3) & ~3\n syms['DIVS'] = labels['DIVS']\n code2, labels2 = sh4asm.assemble(SOURCE, DH_CODE, syms)\n assert len(code2) == len(code)\n labels2.update({k: labels[k] for k in ('DIVS', 'LABEL', 'ITEMS')})\n return code2, labels2\n\n\ndef item(labels):\n \"\"\"Our UTILITY item, 52 bytes, as LED ANIMATION's (OFF / ON).\"\"\"\n g24, g32, g36, g44, g48 = hotcuekeys.GENERIC\n return struct.pack('<13I', labels['LABEL'], hotcuekeys.ONOFF_LIST, 2, 0xFFFFFFFF, 0xFFFFFFFF, 1,\n g24, labels['dh_show'], g32, g36, labels['dh_take'], g44, g48)\n\n\ndef patch(app, stock):\n \"\"\"The application with DIVIDE HOLD added after whatever other mods are\n in: it chains after the decoder literal as it finds it (so it sees the\n keys the others leave to the deck) and adds its item after the UTILITY\n items there are.\"\"\"\n h = hotcuekeys\n out = bytearray(app)\n word = lambda a: struct.unpack_from(' 0xC00487A4)\nTRAMP_TARGET = 0xC00487A4\nMB = 0x1183E000\nDP = 0x11806900\nHEADS = 0x1182E0E0\nLINKS = 0xC1F38B90\nPLAY_HEAD_DP = 969 # byte: the playing head's index\nMARGIN = 750 # slots (10 s) a forward jump leaves decoded ahead (2 s: EMERGENCY LOOP\n # after rapid 8-beat jumps, emulator too; 5 s was fine there)\nBLOCKS = ((0xC0000040, 0xC0000080), (0xC00000A0, 0xC0000100), (0xC0000120, 0xC00001E0))\nFREE_PACKETS = (struct.pack('<8I', *([0x0c6e0c6e] * 7 + [0xefe00000])), # compact nops only\n struct.pack('<8I', *([0x0c6e0c6e] * 6 + [0, 0xe7e00000])))\n\n\ndef code():\n \"\"\"[(addr, word)] of dj_poll.\"\"\"\n a = c6asm.Asm(BLOCKS[0][0])\n o = a.op\n # block 1: the mailbox; e = heads + 30 * h\n o('const', MB, 'a3')\n o('ldw', 'a4', 'a3', 0)\n o('nop', 4)\n o('cmpeq', 1, 'a4', 'a1')\n o('b', 'tail', p='!a1')\n o('nop', 5)\n o('ldw', 'b4', 'a3', 4) # n\n o('lddp', 'ldbu', 'b5', PLAY_HEAD_DP) # h\n o('nop', 4)\n o('shl', 'b5', 5, 'b6')\n o('shl', 'b5', 1, 'b7')\n o('sub', 'b6', 'b7', 'b6') # 30 h\n o('b', 'blk2')\n o('nop', 5)\n # block 2: the head's fields, the direction\n a.org(BLOCKS[1][0])\n a.label('blk2')\n o('const', HEADS, 'b8')\n o('add', 'b8', 'b6', 'b6') # e\n o('ldhu', 'a5', 'b6', 2) # cur\n o('ldh', 'a6', 'b6', 6) # behind\n o('ldh', 'a7', 'b6', 8) # ahead\n o('nop', 4)\n o('stw', 'a5', 'a3', 16)\n o('stw', 'a6', 'a3', 24)\n o('stw', 'a7', 'a3', 28)\n o('mvk', 2, 'a9') # refused unless done\n o('const', LINKS, 'a4')\n o('cmplt', 0, 'b4', 'b0') # n > 0\n o('b', 'fwd', p='b0')\n o('nop', 5)\n o('cmpgt', 0, 'b4', 'b1') # n < 0\n o('b', 'ok', p='!b1') # n = 0\n o('nop', 5)\n o('sub', 0, 'b4', 'b2') # m = -n\n o('mv', 'b2', 'a8')\n o('sub', 'a6', 'a8', 'a8') # behind - m\n o('b', 'blk3')\n o('nop', 5)\n # block 3: the walk\n a.org(BLOCKS[2][0])\n a.label('blk3')\n o('cmplt', 0, 'a8', 'a1') # at least one slot left behind\n o('b', 'done', p='!a1')\n o('nop', 5)\n a.label('loopb')\n o('addaw', 'a4', 'a5', 'a2')\n o('ldhu', 'a5', 'a2', 0) # prev\n o('nop', 4)\n o('add', -1, 'b2', 'b2')\n o('b', 'loopb', p='b2')\n o('nop', 5)\n o('sub', 0, 'b4', 'b7')\n o('mv', 'b7', 'a8') # m\n o('sub', 'a6', 'a8', 'a6') # behind - m\n o('add', 'a8', 'a7', 'a7') # ahead + m\n o('b', 'store')\n o('nop', 5)\n a.label('fwd')\n o('mv', 'b4', 'a8')\n o('sub', 'a7', 'a8', 'a8') # ahead - n\n o('mvk', MARGIN, 'b7')\n o('cmplt', 'b7', 'a8', 'b1') # more than MARGIN left ahead\n o('b', 'done', p='!b1')\n o('nop', 5)\n o('mv', 'b4', 'b2')\n a.label('loopf')\n o('addaw', 'a4', 'a5', 'a2')\n o('ldhu', 'a5', 'a2', 2) # next\n o('nop', 4)\n o('add', -1, 'b2', 'b2')\n o('b', 'loopf', p='b2')\n o('nop', 5)\n o('mv', 'b4', 'a8')\n o('add', 'a8', 'a6', 'a6') # behind + n\n o('sub', 'a7', 'a8', 'a7') # ahead - n\n a.label('store')\n o('sth', 'a5', 'b6', 2)\n o('sth', 'a6', 'b6', 6)\n o('sth', 'a7', 'b6', 8)\n o('sth', 'a5', 'b6', 14) # the point the decoder fills from (set on a\n o('sth', 'a6', 'b6', 16) # pause): moved along, so standing it decodes\n o('sth', 'a7', 'b6', 18) # on from the new place\n o('stw', 'a5', 'a3', 20)\n a.label('ok')\n o('mvk', 1, 'a9')\n a.label('done')\n o('stw', 'a9', 'a3', 8)\n o('ldw', 'a8', 'a3', 12)\n o('nop', 4)\n o('add', 1, 'a8', 'a8')\n o('stw', 'a8', 'a3', 12)\n o('mvk', 0, 'a8')\n o('stw', 'a8', 'a3', 0)\n a.label('tail')\n o('b', TRAMP_TARGET)\n o('nop', 5)\n words = a.assemble()\n for at, _ in words:\n assert any(lo <= at < hi for lo, hi in BLOCKS), 'dspjump: 0x%08x is past its blocks' % at\n return words\n\n\ndef packets(words):\n \"\"\"{packet addr: 8 words}: our words, the rest of each packet nop.\"\"\"\n out = {}\n for at, w in words:\n fp = at & ~31\n out.setdefault(fp, [0] * 8)[(at - fp) // 4] = w\n return out\n\n\ndef set_cst16(word, value):\n return (word & ~(0xFFFF << 7)) | (value & 0xFFFF) << 7\n\n\ndef patch(app, stock):\n out = bytearray(app)\n for fp, ws in packets(code()).items():\n off = B_IMG - BASE + (fp - 0xC0000000)\n if stock[off:off + 32] not in FREE_PACKETS or out[off:off + 32] != stock[off:off + 32]:\n raise SystemExit('patch_cdj900nxs: dspjump: the vector packet 0x%08x is not the expected one' % fp)\n out[off:off + 32] = struct.pack('<8I', *ws)\n entry = BLOCKS[0][0]\n for at, want, value in ((TRAMP_MVK, 0x0543d22a, entry), (TRAMP_MVKH, 0x0560026a, entry >> 16)):\n off = A_IMG - BASE + (at - A_AT)\n w = struct.unpack_from(' red, grey -> dark red\n\nSOURCE = r'''\n; ---- ew_draw: draw_bitmap(r4, r5 x, r6 y, r7 resource) for the playing-address bar\new_draw:\n mov.l E_draw,r0\n mov.l E_res,r1\n cmp/eq r1,r7\n bt ew_bar\n jmp @r0\n nop\new_bar:\n mov.l E_len,r1 ; length in ms: 1/150 s * 20 / 3\n mov.l @r1,r1\n tst r1,r1\n bt ew_plain\n mov r1,r2\n shll2 r2\n shll2 r2\n shll2 r1\n add r2,r1 ; * 20\n mov.l E_div3,r2\n dmulu.l r2,r1\n sts mach,r1\n shlr r1 ; / 3\n mov.l E_pos,r2\n mov.l @r2,r2\n sub r2,r1 ; left\n cmp/pl r1\n bf ew_plain\n mov.l E_warn,r2\n cmp/hs r2,r1\n bt ew_plain\n mov.l r8,@-r15 ; red: the record pointed at RED_BAR for this call\n mov.l r9,@-r15\n sts.l pr,@-r15\n mov.l E_tab,r8\n mov.l @r8,r8\n mov.l E_recoff,r1\n add r1,r8\n mov.l @(32,r8),r9\n mov.l E_redoff,r1\n mov.l r1,@(32,r8)\n jsr @r0\n nop\n mov.l r9,@(32,r8)\n lds.l @r15+,pr\n mov.l @r15+,r9\n rts\n mov.l @r15+,r8\new_plain:\n jmp @r0\n nop\n\n .align 4\nE_div3: .long 0xAAAAAAAB\nE_draw: .long DRAW\nE_len: .long TRACK_LEN\nE_pos: .long POS_MS\nE_recoff: .long REC_OFF\nE_redoff: .long RED_OFF\nE_res: .long RES_BAR\nE_tab: .long RES_TABLE_PTR\nE_warn: .long WARN_MS\n'''\n\n\ndef routine():\n return sh4asm.assemble(SOURCE, EW_CODE, {\n 'DRAW': DRAW, 'TRACK_LEN': TRACK_LEN, 'POS_MS': POS_MS, 'REC_OFF': RES_BAR * 44,\n 'RED_OFF': RED_BAR - RES_BASE, 'RES_BAR': RES_BAR, 'RES_TABLE_PTR': RES_TABLE_PTR,\n 'WARN_MS': WARN_MS})\n\n\ndef patch(app, stock):\n \"\"\"The application with END WARNING added; `stock` is the unmodified 1.31\n application, which every replaced byte is checked against.\"\"\"\n out = bytearray(app)\n word = lambda buf, a: struct.unpack_from('