Why I’m not excited about RISC-V

September 20th, 2022

So while russia is trying to commit political suicide by recognizing its war officially and making it a criminal offence to evade it (or disagreeing with the official course in general), here’s a text I wanted to write for a long time but finished only recently.

In general I’m eager to look at some computer architecture and see how multimedia software can be run there (even if I’m no Måns). For a long time my primary development machine was PowerPC-based (before I could buy some decent x86_64-based laptop), I played with ARMv7 and NEON years before Raspberry Pi was created (but who remembers Beagle Board nowadays?), I had two laptops with Chinese MIPS inside (and tried optimising for Loongson 2 SIMD too), I own ARM64-based box too (and did some work on it as well). I’d like to try RISC-V hardware but the state of RISC-V gives me no excitement and here I’ll try to explain why.
Read the rest of this entry »

Looking at a-Pac

September 19th, 2022

Since currently there’s a preparation phase for the next Ukrainian counteroffensive and I don’t know what other features to add to NihAV (beside improving video player), I was bored enough to do this.

After a comment from Paul, I’ve looked at some random lossless audio codec from 90’s, namely a-Pac. While the codec by itself it very simple (no LPC or IIR filter, no variable-length codes except in block header, no arithmetic coder either) as you can see from its description in the Wiki, it was a bit tricky to RE.

The main issues being: apac.exe is in NE format (which means 16-bit code and Ghidra sucks at figuring out which segment registers should be used when) and, which is worse, written in Delphi with all the quirks of its object model implementation. So it’s after some search I’ve found the virtual table corresponding to the APAC format handler (both coding and decoding) and after trying one function after another I’ve finally found the one responsible for encoding—after which finding a decoder function was easy.

The code itself (beside the weirdness introduced by Delphi compiler like using both positive and negative offsets in vtable calls) is very old-fashioned too: bit reading is done by keeping bitreader state as global variables, reading n-bit values by reading a single bit in a loop and refilling that bit buffer every byte (with a callback function).

It’s still fun to see how we’ve moved from simple formats like this to overcomplicated formats like LA or OptimFrog while settling down on in-between complexity FLAC, Monkey’s Audio and WavPack.

russia and friends

September 12th, 2022

I’ve been wanting to write this for a long time and the russian terrorist attack on Sunday was the last straw.

There a saying: tell me who your friends are, and I will tell you who you are. Of course it’s not always true but it hints on the usual way of choosing friends to have a lot of common with you. The same stands true not just for people but for whole countries as well and you can guess which countries we’re going to look at today.

First, here’s a list of countries that support or openly befriend russia (the list is composed from the countries that russia openly called friends or those behaving in that way):

  • Afghanistan
  • Belarus
  • Burundi
  • Cameroon
  • Chad
  • China
  • Eritrea
  • Ethiopia
  • Guinea
  • Hungary
  • Iran
  • Mali
  • Myanmar
  • North Korea
  • Serbia
  • South Africa
  • Sudan
  • Türkiye
  • Uganda
  • Venezuela
  • Zimbabwe

So what’s common between those countries? They can be divided into two major groups—former colonies with a dictator ruling it (or demokratur, see that post for the explanation) or leftovers of former empires that dream of restoring their old glory (and have about the same government). The first group befriends russia mostly for the benefits (the same way many African countries befriended USSR), the countries from the second group usually went the same way as russia itself and thus they have some class solidarity, though it does not prevent them from (ab)using russia to their own benefit. Now let’s look at them closer.

Negotiable affection friends

Afghanistan. If you haven’t forgotten yet, this is a country where a corrupt weak government was forcefully replaced by a terrorist organisation recognized in the whole world (even russia, which led to a rather funny situation where they invited Taliban representatives to various forums and diplomatic talks while still not lifting a status of terrorist organisation). So you have the same terrorist mindset to keep them close. And in somewhat recent news they asked for a large oil shipments in return for something undisclosed. Considering how good Afghanistan is economically and that russia won’t be able to mine for natural resources there effectively it looks like typical Soviet-African friendship.

Belarus. A former Soviet colony (sometimes called “most Soviet of all Soviet republics”) with a dictator ruling it since 1994. Lukashenko had been using russia for his own benefits (like buying oil cheap from russia and selling petroleum not-so-cheap to Europe or even getting non-returnable loans for various purposes) for a long time, usually under pretence of making Union State something different from a bureaucratic fiction. But after the coup against Belarusian people in 2020 he has to rely on russia for everything and that’s why Belarus serves as a large military base for russian forces and that’s why he makes various bellicose claims (while not actually trying to engage his own forces because they’re more likely to turn against him).

Burundi, Cameroon, Chad, Eritrea, Ethiopia, Guinea, Mali, Sudan, Uganda, Zimbabwe. I can’t say I know much about those countries so let’s look what’s common there. Former colonies (mostly French ones)—check, rather poor countries—check for many of them, dictatorship/demokratur—also check for many of them (or military junta like in Myanmar). So it seems to me they’re friends with russia because they behave the same or just use it to get cheap resources or military equipment.

Myanmar.—this country seem to go the same route as some African countries: former colony, low quality of life and civil war, recent military coup (after which it befriended russia).

North Korea

I think this country makes a category of its own. On the one hand it enjoys benefits from “befriending” russia as it can sell its resources there and send workers to earn good money (by their standards), on the other hand it’s russia that tries to resemble DPRK. And let’s not forget about the recent news about russia buying artillery munition from it (there are unverified claims that in the first months of war russian minister of war went there to beg for other Soviet equipment like missiles). Though the dynamic between North and South Korea reminds a lot about the current situation including the constant threats of using nukes to destroy Americans (in South Korea).

Countries resembling russia

China. This country has history resembling russian one a lot. Having an long-running proud history that’s mostly fake—check, being conquered by Mongols—check, getting rid of an emperor in the beginning of XXth century—check,this event being followed by creating a Western-type government that was deposed by communists—check, communist terror—check, reforms that tried to make the country more open to the West —check, a dictator who wants to bring country back to the glorious past—check. Territorial claims for the (pieces of) neighbouring countries—check. Rather passive population that does not care about anything—check. Not keeping their word, taking whatever businesses they like from the foreigners and not allowing them to de facto own anything—check (yes, China does it in a more refined way but you should remember how your business there should have at least 51% partnership by Chinese and how the stock of Chinese companies traded overseas is not actually a right of ownership in a company and what had happened to ARM China). And of course copying or stealing ideas and design from the West while pretending it’s their own (again, China is doing it much better and actually develops on it). Here’s a personal story: my great-grandfather worked at a local locomotive-building plant (mostly famous for creating the T-34 tank) which was founded by a French society (a fact not often mentioned in the USSR) and in 1950s he was sent to China to help them build their own industry (a fact not mentioned often in China).

Though you should not forget that some of the territories that China wants to return are those taken by russian empire. And you should not forget that China acts pragmatically so when russia threatened to sell its natural resources to China instead of Europe and make reserves in yuan, it essentially made itself dependent on China which can now dictate the prices for oil and gas (and doing operations with yuan also requires an approval of Chinese government). Currently China pretends to not support russia because Western sanctions hurt. But we’ll see if this stops them from attempting to conquer Taiwan.

Hungary. Former Kingdom of Hungary, later part of Austro-Hungarian Empire. Current regime relies on the same principle as russia—praising “traditional values” and hating everything not from the country. And of course they want to get back territories “lost” after 1918: you should remember how orbán asked for Croatian port and pipeline during the European sanctions discussions. And they’ve been giving away Hungarian passports to Ukrainians living in Subcarpathian Ukraine for years along with trying to dictate what Ukraine should do in its region (russia had been doing the same in various places that later it turned into puppet states like Abkhazia).

The related thing is that how the government tries to gloss over its wartime atrocities (for example, this, even if the English version of the article does not mention them) and have installed a hypocritical monument to Hungary being a “victim” to Nazi Germany (being its willing ally until 1944 does not count apparently). The same way russia always accuses Germany attacking it in 1941 while not mentioning that it happened in the Poland which both of them occupied in 1939 (and their co-operation went further than that).

And of course you should not forget that Hungary gets most of its energy from russia: oil, gas and even fuel for nuclear power. Seeing how Hungary sells Serbia gas from an unknown source and then their minister going to Moscow to beg for increased shipment of gas is disgusting. Seeing how a plane delivering nuclear fuel from Moscow lands at NATO base in Hungary or how Hungary allows russia to build a new nuclear power plant right after what they’ve done to Zaporizhzhia nuclear power plant is revolting.

Iran. While I have not heard about them having claims on trying to restore an old empire (which would be some extremely old empire in their case), they’ve been trying to conquer their neighbours (at least Syria) and destroy certain state for purely ideological reasons. They also have nominal democracy (i.e. you can vote for public officials but it’s certain people with religious authority who decide what will be done) and their rhetoric is the same as in russia (at least when russia does not repeat the speeches from Nazi Germany). And considering the recent news about their battle UAVs shipped to russia and a good deal of them being broken right from the start, Iran manufactures the goods (and lies about their quality) about as good as russia.

Serbia. This is a rather sad case. On one hand russian empire was seen there as the defender of Slavic nations in different lands (which has started the World War I among other things) and their historically significant territory Kosovo turned into Kosova. On the other hand Yugoslavia (both kingdom and SFRJ) was a mix of nations with significant differences (mostly in the religion) and typical highlander character that makes peaceful resolving of the conflicts less possible (just look how well various nations in Caucasian nations get along). So when the external pressure that kept them together was gone, the internal tensions made dissolution of Yugoslavian Federation a very bloody process that required an internation intervention to make the bloodbath end more or less. And yet Serbia seems to train its army for invasion instead of defence and considering recent moves on Kosov(a/o) and fuelling tensions in Bosnia and Herzegovina there may be yet another tragedy brewing.

Türkiye. To condense its history, first there had been Ottoman Empire that grew around the Mediterranean Sea plus Central Europe and Mesopotamia, but after WWI it collapsed and was succeeded by Turkey, a country where army made military coups in order to preserve democracy since Mustafa Kemal himself (but sooner or later people elected autocrats anyway). (The) last coup in 2016 has failed and now we have Erdoğan trying to restore the old empire (and since he demanded to change the official country name to Türkiye I’m using it to denote the country under his rule and not the previous state). Of course he also wants to be a sultan and bring back the various pieces of land lost since 1922, from Albania to Yemen.

It’s hard to call him a complete friend of russia as he’s mostly using it for his own needs, but while he had closed Bosporus for their military ships and Turkish airspace for their military planes (mostly because he wants them out of Syria and to stop protecting Armenia as well), at the same time he does not support sanctions against russia and enjoys being an offshore. Recently it was agreed by two dictators that Türkiye will help russia to evade sanctions by allowing russian money in Turkish banks and russian oil to Turkish refineries (so later you can’t track the origin of oil and oil products). It is obvious that he’ll break any agreement with them as soon as it stops being profitable to him—but russia would do the same so they’re a perfect match.

South Africa. This one I can’t tell about but from random news I hear about it, it sounds a lot like russia—a corrupt government, main wealth coming from natural resources, and hardly any of this wealth reaches common people that have to live in shitty conditions.

Venezuela. Another country that resembles russia (and even more it resembles Soviet Union). You have corrupt non-democratic government that stifled all of the opposition, you have wealth coming from the natural resources (oil and gold) and thanks to the mismanagement the population is extremely poor and depends on the dole their government gives them.

Conclusion

I’ve not mentioned sympathisers like France or Italy that receive only russian tourists and oligarchs buying villas and yachts there so they don’t want to do anything against them and would rather have some peaceful solution, those countries are like a lighter version of negotiable affection friends. I’ve not mentioned current Germany that enjoyed cheap oil and gas for its industry and the position of main russian gas distributor for Europe and how this corrupted it on the border with high treason. I’ve not mentioned Armenia that has to be friends with russia because it “defends” it from Azerbaijan (while russia shipped weapons there as well). I’ve not mentioned Georgia that has a government elected on the idea “if you don’t elect us there will be a war with russia again, and here’s a bribe to make you feel less miserable”. I’ve decided to concentrate on the countries that are helping russia willingly (even if that will is compensated).

As you could see, most of russian friends are the countries expecting something (or a lot) in return for their friendship and (with one exception) none of them can be called prosperous. Misery loves company or birds of a feather flock together?

Looking at some FMV formats

September 7th, 2022

It’ll take a long time to liberate Ukraine from the invaders, so while it goes on I have to entertain myself somehow.

Since I had nothing better to do I looked at two FMV games—Deadly Tide and Hot Wheels: Stunt Track Driver. Both of them have their levels packed as video data with some additional control data.

Deadly Tide is more complex one with its L96 format: it defines a resource file with several possible sub-levels and three different video streams (something like 320×240, 160×120 and 80×80) compressed with Cinepak plus half a dozen of various control resources and audio stream.

Hot Wheels uses JAM format which is a series of compressed chunks. 0 – frame data, 2 – palette update (strangely enough it updates palette not from the start but rather to the end), 3 – some control data. Frames are stored either unpacked, packed with LZSS or packed with differential LZSS (in this case copy operation takes bytes from the previous frame). Oh, and it uses obfuscated WAV files for audio that I didn’t bother to look at.

I’m still looking for an interesting format to RE, meanwhile those two were at least somewhat interesting.

Rust inline assembly experience

September 3rd, 2022

Since I need something less exciting than the series about IAEA willingly ignoring the terrorists occupying the largest nuclear power plant in Europe (even during its mission visit there) or the series called “what russia destroyed in my home city today”, I’ve tried inline assembly support in recent stable Rust compiler, here’s a short report.

Since I’m working on a multimedia framework, my primary interest about inline assembly is how well I can add SIMD code for various codecs. My previous attempt was optimising the adaptive filter in Monkey’s Audio decoder and while it worked it looked ugly because of the way Intel named its intrinsics (if you like the names like _mm_madd_epi16 then our tastes are very different) and the verbosity (constant need to cast vectors to different types. So I decided to wait until non-experimental inline assembly support is ready.

This time I’ve decided to look how easy it is to make SIMD optimisations for my own H.264 decoder (and it needs them in order to be usable when I finally switch to my own video player). Good things: I’ve managed to speed up overall decoding about 20%. Bad things: a lot of things can’t be made faster because of the limitations.

For those who are not familiar, H.264 decoder contains a lot of typical operations performed on blocks with sizes 2×2, 4×4, 8×8 or 16×16 (or rectangular blocks made by splitting those in half) with operations being copying, adding data to a block, averaging two blocks and so on.

Writing the code by itself is nice: you can have a function with a single unsafe{ asm!(..); } statement in it and you let the compiler to figure out the details (the rather famous x86inc.asm is mostly written to deal with the discrepancies between ABIs on different platforms and for templating MMX/SSE/AVX code). Even nicer is that you can specify arguments in a clear way (which is much better than passing constraints in three groups for GCC syntax) and used named arguments inside the code. Additionally it uses local labels in gas form which are a bit clearer to use and don’t clutter debug symbols.

Now for the bad things: inline assembly support (as of rustc 1.62.1) is lacking for my needs. Here’s my list of the annoyances with ascending severity:

  • the problem with sub-registers: I had to fill XMM register from a GPR one so I wrote movd xmm0, {val} with val being a 32-bit value. The compiler generated a warning and the actual instruction in the binary was movq xmm0, rdx (which is copying eight bytes instead of four). And it’s not immediately clear that you should write it as movd xmm0, {val:e} in that case (at least Luca has reported this on my behalf so it may be improved soon);
  • asm!() currently supports only registers as input/output arguments while in reality it should be able to substitute some things without using registers for them—e.g. when instruction can take a constant number (like shifts, it’s very useful for templated code) or a memory reference (there are not so many registers available on x86 so writing something like paddw xmm1, TABLE[{offset}] would save one XMM register for loading table contents explicitly). I’m aware there’s a work going on that so in the future we should be able to use constant and sym input types but currently it’s unstable;
  • and the worst issue is the lack of templating support. For instance, I have functions for faster averaging of two blocks—they simply load a certain amount of pixels from each line, average them and write back. For 16×16 case I additionally unroll the loop a bit more. It would be nice to put it into single macro that instantiates all the variants by substituting load/store instruction and enabling certain additional code inside the loop when block width is sixteen. Of course I work around it by copy-pasting and editing the code but this process is prone to introducing errors (especially when you confuse two nearly identical functions—and they tend to become long when written in assembly). And I can’t imagine how to use macro_rules!() to either construct asm!() contents from a pieces or to make it cut out some content out of it. Having several asm!() blocks one after another is not always feasible as nobody can guarantee you that the compiler won’t insert some code between them to juggle the registers used for the arguments.

All in all, I’d say that inline assembly support in Rust is promising but not yet fully usable for my needs.

Update. Luca actually tried to solve templating problem and even wrote a post about it. There’s a limited way to do that via concat!() instead of string substitution and a somewhat convoluted way to fit some blocks inside one assembly template. It’s not perfect but if you’re desperate enough it should work for you.

Ripper: Smackered AVIs

September 1st, 2022

Recently I’ve encountered a review of an old FMV game called Ripper and my professional interest was to look what formats it uses. Well, it turned out to use Smacker and AVI. And those AVI files are their own format that uses Smacker in perverse way: it stores a sequence of commands with 14-byte header that control video playback. The first dozen of commands are usually “fill audio buffer with this data” commands and there’s one command for initialising video that includes full Smacker header inside its payload. From what I see it abuses Smacker decoder by constructing file on the fly using the data from the commands (I’m pretty sure the following commands have video frames in their payload).

I’m not sure if I’d want to pursue it further and document it let alone adding support for it in NihAV but that format was definitely something.

A Quick Look at AVS3

August 15th, 2022

The war has shifted to a terrorist operation against Ukrainian civilians (with no change for my home city, it gets several strikes from russian territory every day regardless) and instead of threatening the world with nuclear war russia threatens the world with nuclear terrorism using the captured Ukrainian nuclear power plant. So here’s yet another attempt to distract myself from thoughts about it.

It seems that AVS3 has been standardised already (and nobody cares). So out of idle curiosity I’ve downloaded the spec from avs.org.cn (in Chinese of course, and it requires you to fill some information but accepted any garbage). So let’s look at this completely original format that has not borrowed anything neither from H.266 nor from AV1.
Read the rest of this entry »

Nazism and russia

August 6th, 2022

First of all, I’d like to say that xenophobia is a natural state of human beings introduced by evolutionary mechanisms (you never knew what to expect from a stranger after all) so it takes some nurturing to overcome it and teach you that you should not fight any unknown person right at the spot. It’s like there’s nothing wrong with defecating per se but you’d normally do it only at designated areas for a variety of reasons, most of them being social and neither being physiological. The problems with racism start where the society not merely abandons the duty of telling why you should not hate people that are different from you but rather starts encouraging hating certain groups of people.

Back in the day it was perceived as normal (and even helped to define the state): we are the beloved children of our god/land/world and any foreigners are just pathetic beasts not worthy of living here. Later it was discovered that foreigners might be useful for something (like trade or providing the skills your people lacked). A millennium or two later a good deal of people finally accepted the idea that all people are equally worthy of something, a couple of centuries later people even agreed that slavery is a bad idea. And yet less then a hundred years ago Germany showed that it’s not something that should be taken for granted and that people are easy to believe in their exclusivity. The lesson has not been learned at all, not even by Germany.

The term “Nazism” comes as an insulting shortening of “National Socialism” but it was socialistic in the name only. People forget that that in Bavaria the favourite first name for males was Ignaz with a diminutive form being… So “Nazism” sounds “an ideology of Bavarian peasants” which is an appropriate thing for self-entitled superhumans. In reality this ideology was based on an idea of racial superiority (and you should know which race was considered superior) and a need to “resolve the problem” that certain “impure” races still exist. And you know what? The chief ideologue, Alfred Rosenberg, came from russian empire when he was over 25 years old (and completing his studies in Moscow). So how was it there at that time?

russian empire was rightfully called the prison of nations (and Soviet Union was not much better either) as it spanned very large territory with many very different nations and they all had various limitations imposed on them (some sources claim that at some moment about 80% of the empire were serfs, after 1861 emancipation reform hardly anything changed for the majority of the population). And it had the famous Pale of Settlement: in the end of XVIII century as large territories (of modern Ukraine, Belarus, Poland and Lithuania) were captured, the empress decided that Jews from those territories should not be allowed to move to the other parts of the empire; that ruling remained in action until the dissolution of the empire. And of course russian language gave the world the word pogrom. What’s interesting there is that those actions against them were not driven by any previous events—there were not so many Jews living in russian empire before to blame them for anything and expel (like it was common in Medieval Europe). In Ukrainian history there’s a sad episode that many Jews were massacred during Khmelnytsky uprising but it was not because they were hated just because they existed but rather because they often were the people hired by Polish nobility to run their estates and businesses and thus they were representatives of the oppressor (it was still wrong to kill them anyway). But whatever happened in russian empire was some ideological anti-Semitism and finally it was exported to Germany as well…

Of course after 1945 Soviet Union pillaged Germany and they took the enriched ideology back (giving such nice examples as “rootless cosmopolite”). Meanwhile the Soviet ideology praised the Soviet man as (ideologically, not biologically) superior to anybody else (and for some mysterious reason it was usually synonymous with russians, just look at the first stanza of the Soviet Anthem), while in reality there was some kind of racial hierarchy with russians on top and various East and Middle Asian nations at the bottom. There’s a rather famous chastushka (a short verse often with a comical meaning):

It’s good that Yuri Gagarin
Is not a Jew, nor he’s a Tatar
Not some (pejorative term for Middle Asians)
But rather he’s our Soviet man.

And it was a common practice to appoint some russian (or, for the lack of those, some Ukrainian or Belarusian) as the second party secretary in each Soviet “republic” so that he could oversee the actions of the first party secretary appointed from the titular nation (I wonder why that term was used almost exclusively in socialist countries).

In the eighties there was a rather curious society called Pamyat formed in Soviet russia. While normal nationalist organisations wanted to have their countries freed from the Soviet yoke, this one wanted to free russia from “Ziono-Masonic plot”—and it kept existing in more or less open form until the dissolution of the USSR. Not a reassuring sign.

In the (formally) post-Soviet russia the structure remained about the same from the Soviet times: there’s Moscow and St. Petersburg that are the only decent places to live, there are regions where common folks live and there are immigrants from Caucasian region and Middle Asia that should not be allowed, especially to Moscow. The longest-running mayor of Moscow is mostly remembered by his hate for those people and introducing special restrictions for people wanting to move to Moscow. A lot of what currently passes for politicians in russia had nationalistic ties as well, for example the former head clown of russian space agency made a political advertisement back in the day with a motto “Clean our cities from trash” alluding to non-russian people.

And of course since the war with Ukraine started they showed their true colours. Top people saying good things about Hitler and Goebbels, using the same terminology as NSDAP like “traitors of the nation”—and that’s between 2014 and 2022 when the war was in the cold phase. After the second phase had started, the whole country was starting to use accidentally created half-swastika everywhere, various writers started praising the war with suspiciously familiar words (one writer actually praised their dictator as the true successor to Hitler who should finish the eternal struggle against the Anglo-Saxon world by winning at last against them). And if you look what they do at war it’s not just genocide of Ukrainians in various ways (massacring Ukrainians, destroying Ukrainian culture at occupied territories and deporting Ukrainian children to russia to raise them in russian “culture”) but it’s also a genocide of various minor nations living in russia. From the statistics I saw their losses were over eighty people from Dagestan and over hundred people from Buryatia to one man from Moscow region (which has larger population than those two regions combined). People from the puppet states at occupied territories of Donetsk and Lughansk regions are also used as cannon fodder and they complained that despite having the same culture and being very closely related to russians (a lot of those people there are descendants of russians moved there in Stalin times) they are treated as inferior to them.

And yet russia accuses other countries of harbouring Nazism and having Nazi population (including Israel). If you look at the tell-tale signs of Nazism you’ll see only two countries conforming to it: russia and Hungary (though Hungarian prime minister said after his speech on Hungarian racial purity that Austrian chancellor thinks the same). So how do you explain the discrepancy between observed Nazism of russia and the countries that russia called so? The answer is simple: russia holds the trademark on it so it decides to whom it shall apply. After all, whom should you believe—your own eyes or their claims?

A quick glance as Titanic: Adventure Out Of Time resources

July 30th, 2022

Recently somebody asked me how to play MOV files from the game. My answer was that I don’t know and we need to wait until somebody reverse engineers of that engine. Meanwhile I took a second look to see if I missed something apparent (spoiler: no).
Read the rest of this entry »

WWIII as the test of political systems

July 24th, 2022

As I wrote previously, I have all reasons to consider what happens now to be World War III and today I want to rant on the political systems of participating countries and how it affects them. For the better understanding of it you should know two terms (both coming from Germany for some reason though it’s disputed for the latter term): finlandisation and Demokratur (literally “democratorship” from democracy+dictatorship, also known as “hybrid” democracy or controlled democracy, i.e. where the system is formally democratic but in reality it’s just a show; for example in GDR any party could exist as long as it was in the alliance with the ruling party so it did not matter for whom you were voting in the end, in North Korea there are two or three parties and all of their members are also the members of the ruling party; all the cases where it does not matter how you voted, only how the votes were counted, and where you have clauses like “a person running for a president in Belarus must have at least five years of experience as a president of Belarus” all fall into this category).

Anyway, let’s look how it all went for the various participants.

The first group is post-Soviet countries. When Soviet Union was dissolved, the republics it was formed from split into three categories: Baltic states that did not want to preserve the communistic past and moved on to the democratic future (which was a right step), countries that were essentially privatised by their rulers (just look at the personalities of first “presidents” of Georgia, Kazakhstan, russia, Turkmenistan and Uzbekistan who were heads of those states at Soviet time and remained in power for decades after that, often passing the post to the personally appointed heir) and countries that were stuck in the middle by replacing the initial ruler after first couple of years but preserving a lot of the Soviet legacy and later either stagnating or falling outright into dictatorship (for example, lukashenko might be the only president of Belarus but the post has been established in 1994, exactly when the first Ukrainian president had resigned).

The second group are various European countries (plus USA) that are mostly democratic except for a couple of democratorship countries (like Hungary). Mainly I can describe them as bureaucratic democracies, with the idea is that the heads of the state are like hired managers that are supposed to serve people’s interests. And, as in large companies, they mostly serve their own interests while making people disinterested in changing things. One of the consequences is that those “managers” stay in power longer than normally elected presidents should (local example: Angela Merkel served as the chancellor for 16 years while it feels for me that ten years should be a limit). Another consequence is that they stifle their opposition (related local example: there was no prominent politician left in the Merkel’s party to be her successor) and they can do what serves them better (we’ll talk about it later when it’s time to say something about gas affecting European politics and finlandisation happening because of it). A related thing: because of the rigidity and bureaucratisation of the political system (most things you can do need to be approved by various committees and other political organs), those heads of the states usually can’t make any drastic domestic policy changes so they resort to foreign politics (just ask any Boris Johnson).

The third group is various non-democratic countries like mainland China (the real China on Taiwan demonstrates how it can be done differently), Iran (people hardly remember it has a president), Syria (is there any reason to comment?) and Türkiye (I call it this way to distinguish newly forming sultanate from the somewhat democratic Turkey and the old Ottoman Empire).

So, how the war affected those political systems?

Bureaucratic democracies showed their slow reaction and ineptitude. Plus it showed how far the process of finlandisation by cheap natural gas went. Of course there’s Hungary that rather honestly says that it won’t survive without cheap fuel from russia (yet it sold Serbia some gas recently) and repeats what kremlin wants it to say (the stuff about sanctions not working, that the war should be ended with talks because 1938 Munich agreement worked so well and so on). Germany is much more disgusting: on the surface it pretends to care, in reality it’s been corrupted (Gazprom Schröder is just the most prominent example) since after 2014 when russia tried to blackmail Europe with gas for the first time and the EU started to develop rules for creating common grid and energy independency, Germany kept sabotaging those efforts and even sold some of its strategic infrastructure to russian gas monopoly (including gas storage facilities); it promised but hasn’t given Ukraine any heavy munition (beside some PzH 2000 which was a big surprise) and blocked other countries from giving Ukraine their Germany-made tanks; recently it specifically lifted some of the sanctions to return compressor turbine to russia after its blackmailing. In my opinion all those current and former higher-ups should be put to prison for corruption and betraying national interests. There’s somewhat similar story with the Switzerland that tries to remain so neutral that I joke it’ll revoke licenses to all its military equipment the instant a country that bought it goes to war. At least some other countries are not that bad and are not willing to close eyes to anything in exchange for cheap gas and oil.

Demokratures are doing more or less fine (China, Hungary, Türkiye and even Belarus) with the one notable exception (you can easily guess which one).

Ukraine is actually doing better than before 2013 (in political sense, whatever happens on its territory is horrible) since the war forged and tempered the national identity (many nations really started to exist only after a freedom war). It also showed what the real enemy is and that Ukraine should purge remains of communist and russian culture (after all, if one of the first things the invaders do is reinstating Lenin monuments that means it’s that’s how they mark their territory and all such markers should be removed from the territory not belonging to them—along with their dead bodies if required). Actually starting from about 2018 a lot of people were tired of frozen conflict and soon newly elected president Zelensky actually tried to downside army somewhat. And then russia accused Ukraine of trying to take occupied Ukrainian territories back and went to occupy even more of Ukrainian territories (and to prove that all ties with it should be severed). But unlike russia, Ukraine is built on traditions of people respecting freedom (maybe even too much, hence the saying that two Ukrainians would make three hetmans) and despite the lack of communications between the Ukrainian troops and their commanders in the first days of war they were able to act on their own. Such country deserves a future.

russia, on the other hand, has never been a democratic land. Kievan Rus’ had democracy, various Hanseatic league members (like Novgorod or Pskov republics) had democracy, even Golden Horde had some democracy. Suzdal principality (where Moscow was built and which later expanded into what we see now) preferred to follow East Roman Empire and to get rid of all possible freedoms. It conquered the aforementioned republics, it eliminated the right of serfs to change their landlord (they could do it once a year before late XVIth century but not in the following three hundred years). Later it conquered large territories and almost always changed the life there for the worse (after conquering Ukraine and part of Belarus it introduced serfdom there and also pale of settlement; whatever happened to Uzbekistan after it got conquered is a sad tale as well). There’s one characteristic feature there—russia preferred to turn its own territory into colonies as it was afraid to manage overseas colonies (that’s why Alaska and Fort Ross were sold to the USA, it’s probably the only case when russia ceded some of its territory voluntarily).

When this rather inhuman regime was replaced with another one in 1917, not many things have changed. There was just one party in the country and you had to belong to it to make any career, there was propiska system where you essentially had to obtain a permit before you could move somewhere and at collective farms (before 1950s IIRC) you had to obtain a permit from the head of that collective farm in order to get an internal passport so you could get propiska and move to a town. As for the politics, there was “the bloc of communists and non-partisans” which created a term “Soviet choice” where you can freely choose from one thing. And all unpopular measures (like rising prices) were provided under the pretext that the working class had asked for it themselves.

So what followed this nice country? Something not that different: the first president of RSFSR co-signed a treaty that dissolved Soviet Union, became the first president of russia and remained at that post until 2000 when he essentially transferred it to the appointed heir. One could argue it was a democratic time when there were more or less free elections but during that time the democracy was destroyed too, mostly under the pretext that if you give people a right to choose then communists will return to power and nobody wants that. So they moved from the usual trickery with rigged voting to getting oligarchs’ support by giving them away state property (essentially the Central Bank decided to store state money in various private banks belonging to certain people who used that money to buy state property or to get it as a collateral for credits they gave to the state with the state money they got) and essentially taming the opposition making it official (unlike USA where two major parties sometimes change positions, in russia the official opposition always remains the official opposition but always votes in favour of the legislation that the dictator or his people tells them to vote for; it got especially obvious in the last decade let alone this year). So when Yeltsin decided to retire, he tried to ensure that he and his Family (daughter, son-in-law and couple of oligarchs around them) remain unpunished, so he appointed a certain guy and oligarchs (who owned all media) ensured that he was elected. Thus an even sadder part of their history began.

The reign of the current dictator started with the Second Chechen War which was won by wiping all what they could. One of the remarkable things at that time was FSB fabricating terrorist acts itself (either to shift blame to Chechen terrorists or to report some cases they managed to “prevent”). One such case got nicknamed “Ryazan’ sugar” after FSB agents leaving a sack of “sugar” in a basement of one living building in Ryazan’. Nobody got punished for that and it set the tone for all the following events (both committing war crimes and blaming them on the others and not punishing underlings for neither failures nor crimes, because that would be treated as a sign of weakness before public. Very democratic). And that’s how it ended in the current state where everybody lies to cover the failures and nobody gets punished for it (essentially only disloyalty gets punished).

This system can exist only in an environment rich of resources where you can waste most of them (because corruption will eat most of it) and yet what remains is enough to sustain the lavish lifestyle of the elites and there’s something for the common folk as well. But they decided to start a way which has cut their income significantly and caused an internal struggle for the dwindling resources (just search the news for how many top managers of large russian companies have died recently), the common folk is ignored as it always has been. So how it can end for them? I see three alternatives (not counting the MAD one): russia dissolves further into smaller states that might not become better but at least they can be forgotten about; russia becomes yet another North Korea—a Chinese colony where almost everything belong to the state (and to the army), everybody works for peanuts, they blame America for their bad life and they do not see or desire any other way of living; or russia might remain a terrorist state like any such state around Israel that russia is friends with—in this case Ukrainian live will be rather similar to Israeli one with regular attacks that are mostly annoying and show their hate. In either case I don’t see it winning since you can’t win by constantly lying to yourself. And showing that how little you honour any agreement as soon as it stops benefiting you is not a good way to make businesses work with you (China does the same thing but it does it much smarter and using point strikes, so it gets a pass for now).

To summarise my long incoherent ramblings in one sentence, this war shows that not all democratic regimes are really democratic and that almost all of the regimes are holding fine except for the one built on lies and incompetency. I expect it to fall apart suddenly, the same way as its predecessor did (even if the war was cold back then).