Friday, June 26, 2020

Real Time Corruptor automation?




Corruptions, corruptions, corruptions. They can happen everywhere at the most critical moment, like copying important financial data from one place to another. But with backups we are safe, yay! But this is not about backups...

So what is Real Time Corruptor (RTC for short)? It's a piece of software that hooks into an emulator's* memory and modifies random bits to some other bits making the game run in unstable way and, in the worst case scenario, crash completely.

This is how it looks like:


But it's not about RTC either, it's about how you could possibly automate (or integrate) it with something that is not just "Start Auto-Corrupt". Well, with the magic of programming you can.

Lately I wrote a small console APP in C that can run desired intensity level by running this APP with a numeric parameter, being that intensity. "What for, you still need to run it manually," you may ask. Well, that's not really the case if you develop something else as well that can run shell APPs. For that Python is helpful. Without much of a hassle one can create Python script to run that application on a command, but what for? Python can be integrated in a lot of tools... *cough*  streaming software *cough*... and then controlled through those means for something outside triggering it to happen - there are those sensor things to developer boards. How about reading loudness and putting that as a corruption. What? You can do that? Yes!

Unfortunately both tools (the APP and the script) are currently closed-source and private, because they were developed with some purpose in mind (no, I'm not revealing it at this point). Buy hey, I can guarantee you that I had it working as a proof-of-concept. Don't believe me? Fine.

And no, I used plain C, not Autohotkey (hint, hint).


* - note that emulation in some countries may be banned. Always use the title you owned and the hardware you owned if you really need to do that (there is just no other way to test how game acts during corruption process)
 
The text below was generated by AI (GPT-2 1.5B). All information is false and is purely for demonstration purposes: 

/* * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * a * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import sys, os import colour char = 0x00 char_buffer = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] GPIO_MODE_INT = 1 GPIO_MODE_DMA = 4 GPIO_MODE_HAS_PRIV = 5 GPIO_MODE_VCTRL2 = 6 GPIO_MODE_VAL3 = 7 GPIO_MODE_PRIV = 8 GPIO_MODE_SLEEP = 9 GPIO_MODE_DMA = 10 GPIO_MODE_DIRMA_VCTRL = 11 GPIO_MODE_MAX28 = 12 GPIO_MODE_MIN2 = 13 GPIO_MODE_JOYB3 = 14 GPIO_MODE_LIBRARY = 15 16 /* Power off, mode and mode_reserved space for arbitrary purposes */ 17 GPIO_UNUSED_MAX = GPIO_UNUSED_MAX + 1 18 SET_RBUFSIZ 8000000 19 GPIO_KEY = 0x00 20 GPIO_UNUSED = GPIO_UNUSED - 1 21 GPIO_USE_UBOOK = 0x01 22 SET_RBUFSIZ 3000000 23 GPIO_UNUSED_0 = GPIO_UNUSED_0 + ( 1 << 13 ) 24 GPIO_UNUSED_1 = GPIO_UNUSED_1 + ( 1 << 12 ) 25 GPIO_UNUSED_2 = GPIO_UNUSED_2 + ( 1 << 11 ) 26 GPIO_UNUSED_3 = GPIO_UNUSED_3 + ( 1 << 10 ) 27 GPIO_UNUSED_4 = GPIO_UNUSED_4 + ( 1 << 9 ) 28 GPIO_UNUSED_5 = GPIO_UNUSED_5 + ( 1 << 8 ) 29 GPIO_UNUSED_6 = GPIO_UNUSED_6 + ( 1 << 7 ) 30 GPIO_UNUSED_7 = GPIO_UNUSED_7 + ( 1 << 6 ) 31 GPIO_UNUSED_8 = GPIO_UNUSED_8 + ( 1 << 5 ) 32 GPIO_UNUSED_9 = GPIO_UNUSED_9 + ( 1 << 4 ) 33 GPIO_UNUSED_0_EN = GPIO_UNUSED_0_EN + ( 1 << 3 ) 34 GPIO_UNUSED_1_EN = GPIO_UNUSED_1_EN + ( 1 << 2 ) 35 GPIO_UNUSED_2_EN = GPIO_UNUSED_2_EN + ( 1 << 1 ) 36 GPIO_UNUSED_3_EN = GPIO_UNUSED_3_EN + ( 1 << 0 ) 37 GPIO_UNUSED_4_EN = GPIO_UNUSED_4_EN + ( 1 << 0 ) 38 GPIO_UNUSED_5_EN = GPIO_UNUSED_5_EN + ( 1 << 0 ) 39 GPIO_UNUSED_6_EN = GPIO_UNUSED_6_EN + ( 1 << 0 ) 40 GPIO_UNUSED_7_EN = GPIO_UNUSED_7_EN + ( 1 << 0 ) 41 GPIO_UNUSED_8_EN = GPIO_UNUSED_8_EN + ( 1 << 0 ) 42 GPIO_UNUSED_9_EN = GPIO_UNUSED_9_EN + ( 1 << 0 ) 43 44 HID_KEY = 0x00 45 SET_RBUFSIZ 20 46 KEY_LENASELEN = 7 47 GPIO_EPROM_PORT = 0xA 48 49 50 51 52

Editing AHX music

 

This is what editing music in AHX format looks like. AHX are small files created in this tracker that gives the tune this unique chiptune vibe to it. In this tracker, however, you can define multiple notes and effects as an instrument itselfl, making those chiptune-like vibrations just by using the final, desired notes in tracker later without any other effects added (if you wish to).

If you want to try it yourself you would need an Amiga computer with hard drive installed or means to run it in software.

1. You need the proper Amiga running for this, I used Amiga 1200,
2. Connect hard drive to it and boot Workbench 3.0 floppy disk installing it on your hard drive,
3. Download AYS-A233.LHA from ahx and extract the archive,
4. Copy extracted files to your Amiga hard drive,
5. When in workbench, open the hard drive, pick view all files from menu (just browse a bit, you will find it),
6. Browse to the directory with AHX installed and double-click AHX-68000 (or AHX-68020 if you have an Amiga with suitable CPU for that),
7. You should be ready to go.

Remember that right mouse click shows menu on Amiga computers.

Sorry for not being detailed enough, I wanted to keep it brief, so you try and figure it out. I think it's always good to learn by trying things by yourself too, not just doing step-by-step instructions.

Also a small update, I minimized the amount of ADs to a minimum, because I hate those lagging sites that even on my Ryzen work like piece of junk... I hope it's OK to keep at least a bit of that content, right? We have those distractors everywhere nowadays... Oh, look... ADD... :)

Monday, September 10, 2018

Allow as low as 1 voice in CoolSoft VirtualMidi Synth

Get rid of CoolSoft VirtualMIDI Synth's hardcoded minimum of 16 voices limit.

So I was previously enjoying the CoolSoft VirtualMIDI ini file hack to allow lower than 16 voices to be set, however, in newest version such ability was completely removed by checking the limit in DLL file as well and overriding the ini set value (unlike previous versions). And I don't want to use outdated version just for this. So I went for an older DLL version which was 32-bit but kept overriding my beautiful voices value of 4, used IDA to show me some assembly, searched for voices and guessed the place (dword and 10h, which means 16, doh). Found it in hex editor and remembered the hex string of that assembly, the most important was 00 00 10 00 00 00, as with x64 assembly is a bit different. Downloaded latest version. But hey, there were a bit more than one 00 00 10 00 00 00, oh well... what's the maximum voices limit? 100 000, so now 100 000 in hexadecimal is? 01 86 A0! Now let's reverse it to have it little endian way. Now let's see if we get 00 00 10 00 00 00 and 00 00 A0 86 01 00 close to each other. Yup, of course there is such a place. And this place, in both EXE and DLL is for voices limit. Vua la, program fixed.

To allow as low as 1 voice in virtualmidi synth do the following:

For version 2.5.3 x64:
- get yourself a hex editor,
- make sure VirtualMIDI Synth is closed and no program is using MIDI (like chrome, steam, any music player) and that VirtualMIDI Synth program is closed,
- navigate to your DRIVE:\Program Files\VirtualMIDISynth,
- edit VirtualMIDISynth.exe in your favourite hex editor,
- change byte 10 [16] at position 3B33 [15 155] to 1 [1],
- navigate to DRIVE:\Windows\system32,
- edit VirtualMIDISynth.dll,
- change byte 10 [16] at position 2507A [151 674] to 1 [1],
- reopen VirtualMIDI Synth and change number of voices to 4 and use chiptune soundfont,
- ????
- enjoy 4 voice channels emulation.

Saturday, December 16, 2017

Teenage Engineering Pocket Operator PO-20 Arcade

Small, portable, mobile protracker-like synthesizer PO-20 Arcade with line-in, line-out (headphones), built-in speaker and display powered by 2 AAA batteries.

more demonstration videos at the bottom of this post

This little thing is amazing. It let's You create some cool beats even with Arcade version which is purely designed for chiptunes music. You have 2 octaves for most samples, some are 0-100 finetune range based instead - You control it with left knob. With right knob You alter the filter so the sound is more deep or fading into higher frequencies (kind of like flange effect). You can also do lead in real-time but I'm mostly programming all the patterns as it's very hard to rotate the knob just on the right note - this is unfortunately a con in this model that You can't use buttons in Note mode. Other models have this feature. You can program max 128-chain of patterns and chords which allows to achieve around 6-7 minutes of programmed music as long as You stick to low BPM like 60 and use 120 BPM beats. The max BPM is 240. A limit of 16 positions per pattern is a bit low but then You can use step multiplier which allows You to pick 2, 3, 4, 6 and 8 multiplier modes for a note witch can quite well overcome this limit. You can also easily copy a pattern so adding new instrument lines is very easy. Unfortunately You can't connect it to PC through USB port or similar to transfer Your creation in ProTracker-like form so if You want to keep the chiptune in mod format You would pretty much need to recreate it there. Nonetheless the device allows You to feel how the ProTracker-like music can be creater by showing You how to arrange your notes to play accordingly to given chord.

The device features:
  • a clock
  • an alarm
  • 2 octaves (A-1 to A-3)
  • 0-100 filter effect per note
  • 16 samples
  • 16 patterns
  • 16 chords
  • 16 live effects
  • 16 volume settings
  • 128-chains
  • parameter locking
  • a drone sound
  • fade out
  • tempo and swing
  • step multiplier
  • copying and clearing a pattern
  • various sync modes with left-right audio channel splitting
  • built-in speaker (I didn't know about that before buying! Nice feature!)
  • powered by 2 AAA batteries (mine rechargeable usually last 2-3 days)



Here are some examples of the music I was able to create by purely improvising:

House:
Rave:

Standard chiptune-like loop:

Techno Club:
Different bpm-swing variation of the above video, for demonstration purposes:
  • 60 bpm setting (120 real) / 80 swing
  • 65 bpm setting (130 real) / 50 swing

  • 90 bpm setting (180 real) / 50 swing


If you want to acquire this device (or a set of them) check out the product page: https://teenageengineering.com/products/po. They sure let you forget about the world around you when you step into music creation mode. :)

If you live in Poland or countries nearby, at this moment it's best to buy it from Czech distributor Kytary: https://kytary.pl/Search/?term=pocket%20operator. They offer reasonable prices and ship with DHL (select PPL as transportation method) and allow paying with Paypal.

Saturday, January 28, 2017

7-ZIP finetuner

Small application to try various 7-ZIP settings to find best combination for given input data. This usually results in smaller archive size.

Help:
7-ZIP Finetuner v1.00 by Mr_KrzYch00

This program will test various 7-ZIP switches known to improve
compression ratio. Smallest resulting file will be kept on disk.

Usage: 7zft [switches] [input files ...] [archive name]

Switches:
   /l#      - 7z executable (default: "c:\program files\7-zip\7z.exe")
   /d#      - dictionary size (default: 512m)
   /s#      - solid block size (default: on)
   /m#      - match finder cycles (default: 4294967295)

This program is provided as-is, use at Your own risk.

Support the author: https://www.paypal.me/MrKrzYch00


Optimization sample:
f:\MyScripts\7z test>7zft Ht_edf_v1 Ht_edf_v1
7-ZIP Finetuner v1.00 by Mr_KrzYch00

LC: 3, LP: 0, PB: 2, YX: 5, FB: 273 (INITIAL RUN) - best: 1372745
LC: 1, LP: 0, PB: 2, YX: 5, FB: 273 - best: 1372697  (-48)
LC: 2, LP: 0, PB: 2, YX: 5, FB: 273 - best: 1372483  (-214)
LC: 1, LP: 1, PB: 2, YX: 5, FB: 273 - best: 1372441  (-42)
LC: 0, LP: 2, PB: 2, YX: 5, FB: 273 - best: 1372264  (-177)
LC: 0, LP: 0, PB: 3, YX: 5, FB: 273 - best: 1372248  (-16)
LC: 1, LP: 0, PB: 3, YX: 5, FB: 273 - best: 1372061  (-187)
LC: 1, LP: 1, PB: 3, YX: 5, FB: 273 - best: 1371695  (-366)
LC: 0, LP: 1, PB: 4, YX: 5, FB: 273 - best: 1371445  (-250)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 273 - best: 1371404  (-41)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 272 - best: 1371393  (-11)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 269 - best: 1371342  (-51)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 260 - best: 1371305  (-37)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 253 - best: 1371303  (-2)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 252 - best: 1371115  (-188)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 172 - best: 1371084  (-31)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 155 - best: 1371069  (-15)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 141 - best: 1371010  (-59)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 134 - best: 1370992  (-18)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 125 - best: 1370980  (-12)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 121 - best: 1370964  (-16)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 70 - best: 1370908  (-56)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 68 - best: 1370846  (-62)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 63 - best: 1370812  (-34)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 54 - best: 1370781  (-31)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 52 - best: 1370756  (-25)
LC: 1, LP: 1, PB: 4, YX: 5, FB: 5              

    SUMMARY:
- Size: 1370756
- LC: 1
- LP: 1
- PB: 4
- Method: LZMA2
- YX: 5
- FB: 52




You can download it from: http://virtual.4my.eu

Tuesday, January 10, 2017

Zopfli on Odroid XU4

Lately I got myself Odroid XU4 microcomputer based on Exynoss 5422 octa core (4x 2Ghz + 4x 1.4Ghz). Surprisingly it can run all 8 cores simultaneously. Unfortunately its size is a bit bigger than Odroid U3 so if You made Yourself some custom made multi-odroid chassis, You would need to rebuild it if You plan to put XU4 in there as well. I mainly bought it to have headless OS with Zopfli KrzYmod running on, doing 999,999 iterations per block. I can confirm that it's around 50% faster than Odroid U3, with single threaded zopfli compression. In my small test of compressing a file using multi-threaded compression it was 55% faster than Odroid U3 O/Ced at 1.92Ghz (limited to 6 threads and various block sizes so it couldn't show its full potential, which I would believe could be up to 75% faster).



Unfortunately it's getting up to 95*C temperature when using all 4 big cores + 1-2 small cores, when small cores are not used the temperature goes to 93*C max. I'm now waiting for Grizzly Kryonaut thermal paste to arrive to apply it on all my RPis and Odroids (and later to apply better cooling solutions in case that won't help much) to make sure they won't get throttled much, especially during summer here.

There is also the same problem that occurs on Odroid U3 being SIGSEGVs with zopfli when long running certain blocks of data. The kernel seems newer on Odroid XU4, so I'm still confused by this error as it is not occurring with x86/x64 builds, might be GCC to generate bogus compilation, or one of the special switches I pass to it for faster builds.

Some tests:

                |       ORIGINAL -O2                   |  Mr_KrzYch00's Zopfli KrzYmod  |
       X        |-----------------------------------------------------------------------|
                | 2016.04.20 | 2016.05.19 | Makefile*  | v16.5.22 --t0 | v16.5.22 --t99 |
----------------------------------------------------------------------------------------|
           real | 15m35.201s | 14m6.836s  | 11m21.864s | 10m56.287s    | 7m11.551s      | - ARM Cortex-A9 - quad @ 1.92Ghz
Odroid U3  user | 14m40.965s | 14m6.480s  | 11m21.580s | 10m55.970s    | 19m30.025s     | (quad-core)
NEON       sys  | 0m53.925s  | 0m0.125s   | 0m0.095s   | 0m0.135s      | 0m0.805s       |
----------------------------------------------------------------------------------------|
           real |            |            |            | 7m21.517s     | 4m40.129s      | - ARM Cortex-A7 - quad @ 1.4Ghz
Odroid XU4 user | [missing]  | [missing]  | [missing]  | 7m21.345s     | 8m27.750s      | - ARM Cortex-A15 - quad @ 2.0Ghz
NEON+VFPV4 sys  |            |            |            | 0m0.080s      | 0m0.180s       | (octa-core)
----------------------------------------------------------------------------------------|
           real | 7m41.104s  | 5m50.010s  | 4m31.952s  | 4m1.706s      | 2m35.052s      | - Core i7-3630QM @ 2.7Ghz
Fedora x86 user | 7m20.247s  | 5m39.968s  | 4m24.474s  | 3m53.982s     | 6m27.671s      | (quad core)
rawhideAVX sys  | 0m9.306s   | 0m0.242s   | 0m0.071s   | 0m0.268s      | 0m2.843s       |
----------------------------------------------------------------------------------------|
           real | 5m59.811s  | 4m25.060s  | 3m38.561s  | 3m31.905s     | 2m17.897s      |
Fedora x64 user | 5m56.214s  | 4m24.860s  | 3m38.295s  | 3m31.776s     | 5m57.761s      |
rawhideAVX sys  | 0m3.543s   | 0m0.118s   | 0m0.208s   | 0m0.056s      | 0m1.636s       |


* - same original Zopfli 2016.05.19 with Zopfli KrzYmod's makefile + profile guided optimizations:
        https://github.com/MrKrzYch00/zopfli/blob/master/Makefile
  --t99 is to force all blocks compression at once - 6 threads used