Raiden Video Ripper

Raiden Video Ripper is an open source project for video editing and format conversion. It is built using Qt 6 (Qt Creator) and allows you to trim and convert videos to MP4, GIF, and WebM formats. You can also extract audio from videos and convert it to MP3 format.
Интерфейс RaidenVideoRipper

Still from COSTA RICA IN 4K 60fps HDR (ULTRA HD)
https://www.youtube.com/watch?v=LXb3EKWsInQ
Please visit the Releases page to stay up to date with the latest releases and updates:
https://github.com/demensdeum/RaidenVideoRipper/releases

Donki Hills

In a month I made a funny gag, a parody game using the Unreal Engine 5 engine. The development was carried out on a Twitch stream.

The story of this game tells about an ordinary Russian guy James, who found a girl Maria on Tinder, but due to sanctions and the closure of Tinder in Russia, he lost contact with her. Now the only thing he has left is a screenshot of her photo, with the help of Google Maps he finds the place where the photo was taken – the village of Tikhie Donki near Novosibirsk. James goes there to look for Maria…

https://demensdeum.itch.io/donki-hills

Cryptomus Blocks Bitcoins and Demands Passport Scans

An amazing incident happened to my friend, let’s call him Oleg. In 2014, Oleg found the Xchange exchanger on the bestchange website and bought $100 worth of bitcoins there. They went to his Bitcoin Core cold wallet, after which he quietly forgot about them. Yesterday he tried to sell some of his bitcoins, he did everything as usual.

He visited the website https://www.bestchange.ru and found several exchangers and tried to sell cryptocurrency there. Since he is a very cautious person, he transferred several parts to three exchangers with the highest ratings. As a result, the situation was such that all three exchangers blocked his funds under the pretext of “not passing the AML check”, and they began to demand an answer as to where these coins appeared on his accounts, and then passport scans for verification and a banal return of coins to the wallet.

We live in interesting times, a person sends his coins for exchange, they are blocked and also require a scan of the passport. They force you to give your passport for unclear purposes, so that later, if you are lucky, they can return his crypto-coins taking part of the amount for the service commission, and naturally the miners also take part of the funds for the transactions.

I urge everyone to be careful with the site https://www.bestchange.ru and the exchangers in the top that look different, but lead to the office https://cryptomus.com, which blocks funds and starts demanding documents from you in order to return these funds. By the way, the site itself allows the exchanger admins to very easily disable your review about it.

I know of at least three exchangers that work through Cryptomus and block funds for AML: Sova, Safelychange, OneMoment.

Forewarned is forearmed.

Sources
https://www.bestchange.ru/faq.html#frozen- transaction
https://www.youtube.com/watch?v=_N_MSD1iFHo
https://demensdeum.com/cryptoBBS/showthread.php?tid= 1

Robot Defenders

Very often, during discussions about the correct operation of some software feature, I encounter a situation where the functionality from the user’s side looked strange, illogical. The discussion with the product owner looked something like this:

–There is clearly a behavioral problem here
– Well, we’ll release it and when users start complaining, then we’ll fix it
– ??? Well ok…

It seems to be a working scheme, right? A fairly optimal algorithm for teams with a small budget, tight deadlines, insufficient research/lack of UI/UX specialist. Users will complain if anything, no big deal.
A Google search shows that the source of this method comes from the article – “Complaint-Driven Development” by Coding Horror

Once I was punching products, including a bologna sausage for 300 rubles, through a terminal in a supermarket, I left the store with this sausage, fully confident that it was paid for – the terminal offered not to print a receipt and I agreed, so as not to waste precious paper on this receipt. During the process of “punching” the product for each product, the terminal beeped, which signals that everything worked correctly. Plus, with an audible notification, the terminal winked with the backlight from the barcode scanner.

The next day I went to the supermarket for groceries again, scanned the products through the terminal. At the exit I was met by a man of southern appearance with a thick beard, holding out his smartphone he said – “Is that you on camera?”, I looked at his phone and saw myself in a Melodic-Death-Metal T-shirt of the band Arch Enemy with skulls and all that, there was no reason to doubt.
“Yes, it’s me, what’s the matter?” the man, squinting very hard, said “You didn’t get the sausage yesterday” – wow

After a short clarification of who he was and how he made these conclusions, he showed me a video hanging on the ceiling of the store, in the video I punch a sausage, the terminal blinks with the backlight from the scanner, I put the sausage in the bag.

– The video shows how the scanner worked
– You haven’t worked anything, pay for the sausage!

Slightly taken aback by this attitude, I demanded a complaint book to write that the terminal needs software improvements, since it gives all the signs of correct operation, but in fact it simply glitches, without signaling about it on the screen.

After 10 minutes of bickering with him and his boss, who immediately came running to defend his employee and the poorly working terminal, they decided to call the administrator’s girl so that she would bring the complaint book and punch in the doctor’s sausage.

That day I realized how difficult it is for users to complain about hardware and software products, and that the mantra “people will complain – we’ll fix it” most likely works very poorly. The main reason is people who defend broken robots, broken software solutions, for simplicity I propose to introduce new terms – Defender of a Broken Robot and Defender of Broken Systems.

Ordinary users cannot complain about the malfunctioning of terminals because they are bothered by Zasroshniki, who for some reason become attached and start to love the machines they work with, perhaps considering them some kind of animate entities, forgetting that there is nothing alive there.

A similar situation occurs with ZaSS people, these people can foam at the mouth to defend some stupid shortcomings in frameworks, programming languages ​​or any other software product, despite complaints from users and other developers.
A typical conversation with a ZaSSshnik is as follows:

– Here’s something that doesn’t work, according to the documentation everything seems to be correct
– Ah, so you haven’t read that manual from 2005, where at the bottom in small letters it says that you need to add PROGRAM_START:6969
– ??? uh

Such people may not understand how they themselves contribute to the spread of problems, errors, loss of time and money for themselves and others. Because of them, everyone suffers, because digital transformation is impossible if the non-obvious, problems of software and hardware solutions are hushed up.
I know about the recent story of the Horizon bug in the British Post Office software, which has been driving people into debt, ruining marriages and lives for decades. It all happened because people kept silent about the software problems, thereby “protecting” it.

Friends, don’t be ZaSRoshniks and ZaSSoshniks, treat the tools you work with with a grain of salt, otherwise you are in danger of being totally enslaved by crappy, broken systems, like hostages in the new digital world of the future. For those who can’t – at least don’t interfere with other people trying to pay attention to non-working, interfering software/hardware, because the developers of these products agreed – “When users start complaining, then we’ll fix it”

Sources
https://blog.codinghorror.com/complaint-driven-development/< /a>
https://habr.com/ru/articles/554404/< br />
https://en.wikipedia.org/wiki/British_Post_Office_scandal

Building bgfx Emscripten application

In this note I will describe a way to build bgfx applications for the web (WebAssembly) via Emscripten.

The installation platform is Linux x86-64, such as Arch Linux.

First, install Emscripten version 3.1.51, otherwise you won’t succeed, all because of the change in the type of dynamic libraries in the latest version of Emscripten. You can read more here:
https://github.com/bkaradzic/bgfx/discussions/3266

It’s done like this:


git clone https://github.com/emscripten-core/emsdk.git



cd emsdk



./emsdk install 3.1.51



./emsdk activate 3.1.51



source ./emsdk_env.sh



Let’s assemble bgfx for WebAssembly – Emscripten:


mkdir bgfx-build-test



cd bgfx-build-test



git clone https://github.com/bkaradzic/bx.git



git clone https://github.com/bkaradzic/bimg.git



git clone https://github.com/bkaradzic/bgfx.git



cd bgfx



emmake make wasm-debug



As a result, in the .build folder you will have bitcode files with the .bc extension, which you will need to link with your bgfx application.
There should be bgfx.bc, bx.bc, bimg.bc; different builds have different names for these files, depending on the build type (release/debug)

Add a link to .bc files to the CMakeLists.txt file, for example, absolute paths to files from the bgfx-experiments project:


target_link_libraries(${PROJECT_NAME} SDL2 GL /home/demensdeum_stream/Sources/bgfx-build/bgfx/.build/wasm/bin/bgfxDebug.bc /home/demensdeum_stream/Sources/bgfx-build/bgfx/.build/wasm/bin/bxDebug.bc /home/demensdeum_stream/Sources/bgfx-build/bgfx/.build/wasm/bin/bimgDebug.bc)



Now change the native window handle in platform data on bgfx initialization:


bgfx::PlatformData platformData{};



platformData.context = NULL;



platformData.backBuffer = NULL;



platformData.backBufferDS = NULL;



platformData.nwh = (void*)"#canvas";



You also need to change the render type to OpenGL:


bgfx::Init init;



init.type = bgfx::RendererType::OpenGL;







init.resolution.width = screenWidth;



init.resolution.height = screenHeight;



init.resolution.reset = BGFX_RESET_VSYNC;



init.platformData = platformData;







if (!bgfx::init(init))



{



    throw std::runtime_error("Failed to initialize bgfx");



}



Recompile GLSL shaders for 120:


shaderc -f "VertexShader.vs" -o "VertexShader.glsl" --type "v" -p "120"



shaderc -f "FragmentShader.fs" -o "FragmentShader.glsl" --type "f" -p "120"



Of course, .glsl files need to be added to CMakeLists.txt as –preload-file:


set(CMAKE_CXX_FLAGS ... <Остальная часть>



--preload-file VertexShader.glsl \



--preload-file FragmentShader.glsl \



All that’s left is to replace the main render loop in your app with while and call the function via emscripten_set_main_loop.

You can read about it here:
https ://demensdeum.com/blog/ru/2017/03/29/porting-sdl-c-game-to-html5-emscripten/

Then build your Emscripten project as usual, everything should work.
Interestingly – it seems that the Emscripten 3.1.51 build lacks OpenAL (or maybe it’s just me).

Source code of the project that builds correctly with bgfx and Emscripten:
https://github.com/demensdeum/ bgfx-experiments/tree/main/2-emscripten-build

Sources

https://github.com/bkaradzic/bgfx/discussions/3266
https://bkaradzic.github.io/bgfx/build.html
https://emscripten.org/docs/getting_started/downloads.html
https ://demensdeum.com/blog/ru/2017/03/29/porting-sdl-c-game-to-html5-emscripten/
https://llvm.org/docs/BitCodeFormat.html

Porting Surreal Engine C++ to WebAssembly

In this post I will describe how I ported the Surreal Engine game engine to WebAssembly.

Surreal Engine is a game engine that implements most of the functionality of the Unreal Engine 1 engine, famous games on this engine are Unreal Tournament 99, Unreal, Deus Ex, Undying. It belongs to the classic engines that worked mainly in a single-threaded execution environment.

My initial idea was to take on a project that I couldn’t complete in any reasonable amount of time, thus showing my Twitch followers that there are projects that even I can’t do. On my very first stream, I suddenly realized that the task of porting Surreal Engine C++ to WebAssembly using Emscripten was doable.

Surreal Engine Emscripten Demo

A month later I can show my fork and assembly of the engine on WebAssembly:
https://demensdeum.com/demos/SurrealEngine/

The controls are the same as in the original, using the keyboard arrows. Next, I plan to adapt it to mobile controls (touch), add correct lighting and other graphic features of the Unreal Tournament 99 render.

Where to start?

The first thing I want to say is that any project can be ported from C++ to WebAssembly using Emscripten, the only question is how complete the functionality will be. Choose a project whose library ports are already available for Emscripten, in the case of Surreal Engine, you are very lucky, because the engine uses the SDL 2, OpenAL libraries – they are both ported to Emscripten. However, Vulkan is used as a graphics API, which is currently not available for HTML5, work is underway to implement WebGPU, but it is also in the draft stage, and it is also unknown how simple the further port from Vulkan to WebGPU will be, after its full standardization. Therefore, I had to write my own basic OpenGL-ES / WebGL renderer for Surreal Engine.

Building the project

The build system in Surreal Engine is CMake, which also simplifies porting, since Emscripten provides its own native builders – emcmake, emmake.
The Surreal Engine port was based on the code of my last game on WebGL/OpenGL ES and C++ called Death-Mask, because of this the development went much easier, all the necessary build flags were with me, code examples.

One of the most important points in CMakeLists.txt is the build flags for Emscripten, below is an example from the project file:


-s MAX_WEBGL_VERSION=2 \

-s EXCEPTION_DEBUG \

-fexceptions \

--preload-file UnrealTournament/ \

--preload-file SurrealEngine.pk3 \

--bind \

--use-preload-plugins \

-Wall \

-Wextra \

-Werror=return-type \

-s USE_SDL=2 \

-s ASSERTIONS=1 \

-w \

-g4 \

-s DISABLE_EXCEPTION_CATCHING=0 \

-O3 \

--no-heap-copy \

-s ALLOW_MEMORY_GROWTH=1 \

-s EXIT_RUNTIME=1")

The build script itself:


emmake make -j 16

cp SurrealEngine.data /srv/http/SurrealEngine/SurrealEngine.data

cp SurrealEngine.js /srv/http/SurrealEngine/SurrealEngine.js

cp SurrealEngine.wasm /srv/http/SurrealEngine/SurrealEngine.wasm

cp ../buildScripts/Emscripten/index.html /srv/http/SurrealEngine/index.html

cp ../buildScripts/Emscripten/background.png /srv/http/SurrealEngine/background.png

Next, we’ll prepare index.html, which includes the project file system preloader. For posting on the web, I used Unreal Tournament Demo version 338. As you can see from the CMake file, the unpacked game folder was added to the build directory and linked as a preload-file for Emscripten.

Major code changes

Then it was necessary to change the game loop, you can’t run an infinite loop, it leads to the browser freezing, instead you need to use emscripten_set_main_loop, I wrote about this feature in my 2017 note “Porting SDL C++ game to HTML5 (Emscripten)
We change the code for the condition for exiting the while loop to if, then we output the main class of the game engine, which contains the game loop, to the global scope, and write a global function that will call the step of the game loop from the global object:


#include <emscripten.h>

Engine *EMSCRIPTEN_GLOBAL_GAME_ENGINE = nullptr;

void emscripten_game_loop_step() {

	EMSCRIPTEN_GLOBAL_GAME_ENGINE->Run();

}

#endif

After this, you need to make sure that there are no background threads in the application. If there are, then get ready to rewrite them for single-thread execution, or use the phtread library in Emscripten.
The background thread in Surreal Engine is used to play music, the main thread of the engine receives data about the current track, about the need to play music, or its absence, then the background thread via mutex receives a new state and starts playing new music, or pauses. The background thread is also used to buffer music during playback.
My attempts to build Surreal Engine under Emscripten with pthread were unsuccessful, because the SDL2 and OpenAL ports were built without pthread support, and I did not want to rebuild them for the sake of music. Therefore, I moved the background music thread functionality to single-thread execution using a loop. Having removed pthread calls from the C++ code, I moved buffering, music playback to the main thread, so that there were no delays, I increased the buffer by several seconds.

Next I will describe specific implementations of graphics and sound.

Vulkan is not supported!

Yes, Vulkan is not supported in HTML5, although all the advertising brochures point out cross-platform and wide support on platforms as the main advantage of Vulkan. For this reason, I had to write my own basic graphics renderer for a simplified type of OpenGL – ES, it is used on mobile devices, sometimes does not contain fashionable features of modern OpenGL, but it is very well transferred to WebGL, this is what Emscripten implements. Writing a basic tile renderer, bsp rendering, for the simplest display of GUI, and drawing models + maps, was possible in two weeks. This was probably the most difficult part of the project. There is still a lot of work ahead to implement the full functionality of the Surreal Engine rendering, so any help from readers in the form of code and pull requests is welcome.

OpenAL is supported!

It was a great stroke of luck that Surreal Engine uses OpenAL for audio output. After writing a simple hello world in OpenAL and building it in WebAssembly using Emscripten, it became clear to me how simple it all is, and I set out to port the audio.
After several hours of debugging, it became obvious that there are several bugs in the OpenAL implementation of Emscripten, for example, when initializing the reading of the number of mono channels, the method returned an infinite number, and after trying to initialize a vector of infinite size, C++ crashes with the exception vector::length_error.
This was circumvented by hardcoding the number of mono channels to 2048:


		alcGetIntegerv(alDevice, ALC_STEREO_SOURCES, 1, &stereoSources);



#if __EMSCRIPTEN__

		monoSources = 2048; // for some reason Emscripten's OpenAL gives infinite monoSources count, bug?

#endif



Is there a network?

Surreal Engine currently does not support network play, play with bots is supported, but someone is needed to write AI for these bots. Theoretically, it is possible to implement network play on WebAssembly/Emscripten using Websockets.

Conclusion

In conclusion, I would like to say that porting Surreal Engine turned out to be quite smooth due to the use of libraries for which there are Emscripten ports, as well as my previous experience implementing a game in C++ for WebAssembly on Emscripten. Below are links to sources of knowledge, repositories on the topic.
M-M-M-MONSTER KILL!

Also, if you want to help the project, preferably with WebGL/OpenGL ES render code, then write to me in Telegram:
https://t.me/demenscave

Links

https://demensdeum.com/demos/SurrealEngine/
https://github.com/demensdeum/SurrealEngine-Emscripten

https://github.com/dpjudas/SurrealEngine

Flash Forever – Interceptor 2021

Recently, it turned out that Adobe Flash works quite stably under Wine. During a 4-hour stream, I made the game Interceptor 2021, which is a sequel to the game Interceptor 2020, written for the ZX Spectrum.

For those who are not in the know – the Flash technology provided interactivity on the web from 2000 to around 2015. Its shutdown was prompted by an open letter from Steve Jobs, in which he wrote that Flash should be consigned to history because it lagged on the iPhone. Since then, JS has become even more sluggish than Flash, and Flash itself has been wrapped in JS, making it possible to run it on anything thanks to the Ruffle player.

You can play it here:
https://demensdeum.com/demos/Interceptor2021

Video:
https://www.youtube.com/watch?v=-3b5PkBvHQk

Source code:
https://github.com/demensdeum/Interceptor-2021