Decompiling Sonic Runners

Usually, when you hear about games being decompiled and rebuilt, the games are often decades-old relics, loving and saved from the ravages of time. [MattKC] recently set out to decompile the 2015 game Sonic Runners.

The game was a 2D endless runner released on mobile platforms. Despite getting praise for the gameplay, it received mixed reviews for the pop-up ads and pay-to-play elements. A little over a year later, the game was discontinued. However, the game required a constant online connection, so once the servers were offline, it rendered the over five million downloads unplayable.

A team of developers worked to reverse engineer the server, and with a little bit of binary hacking, the client could be patched to connect to a community-hosted server instead. However, as phones with notched displays came out and suggestions for improvements stacked up, the community realized a new client would bring immense benefits. Compared to many decompilation projects, Sonic Runners was pretty easy as it uses Unity, which means most of the code is in C#. Unfortunately, the build of Unity used by the game is from 2012, meaning many of the tools designed for much later versions of Unity were inoperable.

However, one native code library called UnmanagedProcess was designed to confuse reverse engineering efforts. The library handled AES encryption and communication with the server. Luckily, the library was a later addition, and earlier versions of its functions still lingered in the C# code. Since an open source server already existed, it was trivial to validate the changes. Additionally, all the shaders were in OpenGL Shading Language (GLSL), which meant rewriting them in High-Level Shading Language (HLSL) and checking that they matched the original GLSL when building for Android.

Now the client has new game modes, no ads, and a proper offline mode. The community continues adding new features and refining the game, which is very satisfying. If you’re curious about reverse engineering, [Matthew Alt] can help you get started.

Continue reading “Decompiling Sonic Runners

Where Did Your PCB Go Wrong? KiRI Knows

When working on a PCB design in KiCad, it’s helpful that the files are all text and can easily be checked into Git or other source control. However, stepping back through the revisions to determine where precisely a trace got routed wrong can be tricky. [Leandro] started with a simple script that exported the KiCad project to an image for inspection — over time it grew into a full-blown visual diff tool named KiCad Revision Inspector (KiRI).

The primary mechanism exports the revisions of a KiCad 5, 6, or 7 project to SVG, which can then be compared via a handy onion skin view. As this is a tool written for those using KiCad, shortcuts are a huge part of the experience. A command line interface generates artifacts to view the diff in any web browser. As these outputs have the KiRI tooling baked in, it is relatively easy to archive the output as a build artifact and allow easy access to review design changes.

For the long-time reader, you might remember back in 2018 talked about another diffing tool called plotgitsch (which this KiRI uses for KiCad 5 projects). KiCad has grown significantly in the last five years. It might be time to update our tips to utilize Git better for your PCB designs.

Continue reading “Where Did Your PCB Go Wrong? KiRI Knows”

2023 Hackaday Prize: Two Bee Or More Bee Swarm Detection

In the bustling world of bees, swarming is the ultimate game of real estate shuffle. When a hive gets too crowded or craves a change of scenery, colonies scout out swarms for a new hive. [Captain Flatus O’Flaherty] is a beekeeper trying to capture more native honey bees, and a custom LoRa-enabled capture hive helps him do that.

A catch hive, perched high and mighty, lures scouting as potential new homes. If selected, a swarm of over a thousand bees can move in, where [Flatus]’s detector comes in. Many catch hives are scattered around, and manually checking them is difficult. While the breath of one bee is hard to see, a thousand bees produce enough CO2 to be detected by a sensor. A custom PCB with a solar-powered  +30dB LoRa radio measures CO2 and reports back. The PCB contains an ESP32 D4 and a 1-watt Ebyte E22-400M30S LoRa module. If the CO2 levels are still elevated at nightfall, [Flatus] can be pretty confident a swarm has moved in.

Using the data collected, he massaged it to create a dataset suitable for training on XGBoost. With weather data and other conditions, the model tries to predict when a swarm is more or less likely to happen. Apis Mellifera (the local honeybee around [Flatus]) loves sun-kissed, warm, humid afternoons with little wind.

We’ve seen beehive monitors before and love exploring what the data could be used for—video after the break.

Continue reading “2023 Hackaday Prize: Two Bee Or More Bee Swarm Detection”

Adding MMIO RAM On The RP2040

[Dmitry Grinberg] is an adept tinkerer who wanted a much larger RAM space on his Raspberry Pi 2040 (RP2040) than the measly 264kb on-board SRAM. The chip does support 16MB of off-flash memory via a QSPI bus, but this must be accessed explicitly rather than being memory mapped. With clever trickery involving XIP (Execute in Place), Dmitry mapped 8MB of external QSPI RAM into the address space.

XIP mode allows the chip to fetch data on-demand from an external chip and place it into RP2040 caches mapped at 0x10xxxxxx. The RP2040, although incredibly versatile, has a limitation – it can only perform read and execute operations in its XIP mode. The first step to solving this was to get data from persistent storage to RAM on boot. Armed with a dual-OR gate IC, an inverter, and two resistors, [Dmitry] can toggle the nCS pin that selects between flash and RAM. A first-stage bootloader copies the program from flash to RAM, then sets up XIP mode and launches into a second-stage loader.

Continue reading “Adding MMIO RAM On The RP2040”

the PCB without the case on, showing the screen, battery, and removable sensor

2023 Hackaday Prize: A Reusable Plant Monitor

[Ovidiu] cares for their house plants, trying to dial in the perfect soil humidity and light levels. However, many cheap monitors tend to rust after a few weeks of sitting in a damp, slightly acidic environment. By creating a custom plant monitor with a removable probe, not only can [Ovidiu] integrate better with their Home Assistant setup, but it will also be less wasteful.

The build starts with an ESP32-S3, a TP4056 charging circuit, a small e-ink display, and an AHT20 IC for air humidity and temperature. The ESP32 reads the probe using the capacitance measuring devices for touchpads built into the chip. Or course, a 450mAh battery provides a battery life of about 11 days. The probe is just a bare PCB with a connector at the top, making them cheap and easy to swap. They included pads on the probe for a thermistor for reading soil temperature, but this is optional. A handsome 3D-printed case wraps it all up nicely.

Continue reading “2023 Hackaday Prize: A Reusable Plant Monitor”

UChaser Follows You Anywhere

If you’ve been making up for lost years of travel in 2023, you might have seen a fellow traveler in the airport terminal or train station walking with their luggage happily careening behind them. [Jesse R] and [Brian Lindahl] wanted more of that. They wanted an open-source, low-cost system that could be put in anything.

The basic principle is that they will have a transmitter that sends both a radio signal and an ultrasonic pulse. The receiver receives the radio signal and uses it as a reference for the two ultrasonic sensors. The time since the radio signal is compared between the two, and a distance and direction are established.

In practice, the radio is an ESP32-S3 using ESP-NOW (which we’ve seen relatively recently on another project), a protocol from Espressif that offers low latency 250 bytes payloads. The ultrasonic transceiver is based on Sparkfun’s HC-SR04. For prototyping purposes on the receiver, they just removed the transmitter to avoid populating the airwaves, as to listen, you had to transmit. The prototype was an electric wheelbarrow that would happily follow you around the yard wherever you go.

With the concept validated, they moved to a custom ultrasonic setup with a custom buffer amp and damp transistor, all centered around 20kHz. The simulations suggested they should have been better than the HC-SR04 from Sparkfun, but the 30-foot (9 meters) range went to 10 feet (3 meters). They ultimately returned to using Sparkfun’s circuit rather than the custom amp.

We’re looking forward to seeing the project continue. There are various challenges, such as variability in the speed of sound, echos and reflections, and ultrasonic line of sight. We love the peak behind the curtain that allows us to see what decisions get made and the data that informs those decisions. All the code and PCB design files are available on GitHub under an MIT and Creative Common license, respectively. This project was submitted as part of the 2o23 Hackaday Prize.

Video after the break.

Continue reading “UChaser Follows You Anywhere”

2023 Hackaday Prize: A Reinvented Solar Tracker

It probably goes without saying that solar panels need to be pointed at the sun for optimal performance. The tricky bit is that the sun has a funny habit of moving on you. For those with a solar panel on their balcony or garden, mysoltrk tracks the sun to get the most out of a small solar panel.

[Fulvio] built the tracker to be solid, low cost, and sturdy enough to survive outdoors, which is quite a tall order. Low cost meant WiFi and GPS were out. The first challenge was low-cost linear actuators that were 3D printed with a mechanism to lock the shaft. An N20 6 volt 30 RPM geared motor formed the heart of the actuator. Four photo-resistors inside a printed viewfinder detect where the sun is, allowing the system to steer the array to get equal values on all the sensors. An Arduino Nano was chosen as it was low power, low cost, and easy to modify. A L298N h-bridge drives the motors, and a shunt is used instead of limit switches to reduce costs further.

There are a few other clever tricks. A voltage divider reads the power coming off the panel so the circuit doesn’t brown out trying to move the actuators. The load can also be switched off via an IRL540n. As of the time of writing, only the earlier versions of the code are up on GitHub, as [Fulvio] is still working on refining the tracking algorithm. But the actuators work wonderfully. We love the ingenuity and focus on low cost, which probably explains why mysoltrk was selected as a finalist in the 2023 Hackaday Prize Green Hacks challenge.

Continue reading “2023 Hackaday Prize: A Reinvented Solar Tracker”