Contents

My Work

At the heart of countless devices and servers, the  Linux kernel stands as a testament to collaborative open-source development. With over 20 commits, I have made notable contributions, including:

Linux booting on Lumia 535

As the gold standard implementation of the  Python programming language, written in the C language, CPython, provides a robust and reliable interpreter for usecases from small scripts to large-scale systems. I have contributed to the project by:

Renowned for its high-fidelity emulation and rich feature set, melonDS has emerged as the go-to emulator for the Nintendo DS. I am a member of the melonDS team, actively engaged on adding new features, reviewing pull requests and code from external collaborators and tracing issues. Some of my significant contributions are:

  • Porting it to macOS (both x86-64 and ARM64 architectures), including adding a workaround in assembly code for the Mach-O executable format used

  • Redesigning the interface for configuring input to make it elegant and easier to use using the Qt framework:

    BeforeAfter
    Interface beforeInterface after
  • Developing a new interface to view game information, which includes decoding the 5-bit bitmap and 16-bit palette, and repacking it into 32-bit ARGB

    Image decoder C codeInterface
    void ROMIcon(const u8 (&data)[512], const u16 (&palette)[16], u32 (&iconRef)[32*32])
    {
    /* Precalculate palette to improve performance */
    u32 paletteRGBA[16];
    for (int i = 0; i < 16; i++)
    {
    u8 r = ((palette[i] >> 0) & 0x1F) * 255 / 31;
    u8 g = ((palette[i] >> 5) & 0x1F) * 255 / 31;
    u8 b = ((palette[i] >> 10) & 0x1F) * 255 / 31;
    u8 a = i ? 255 : 0;
    // Pack each 8-bit colour into one RGBA8888 pixel
    paletteRGBA[i] = r | (g << 8) | (b << 16) | (a << 24);
    }
    int count = 0;
    /* Iterate through 16 tiles of 8x8 pixels */
    for (int ytile = 0; ytile < 4; ytile++)
    {
    for (int xtile = 0; xtile < 4; xtile++)
    {
    for (int ypixel = 0; ypixel < 8; ypixel++)
    {
    for (int xpixel = 0; xpixel < 8; xpixel++)
    {
    /* Calculate palette index using either upper or lower nibble of byte */
    u8 pal_index = count % 2 ? data[count/2] >> 4 : data[count/2] & 0x0F;
    iconRef[ytile*(64*4) + ypixel*32 + xtile*8 + xpixel] = paletteRGBA[pal_index];
    count++;
    }
    }
    }
    }
    }
    ROM Info dialog
  • Added battery level emulation utilising low-level bit manipulation in C to configure the registers

    Underlying C codeInterface
    enum
    {
    batteryLevel_Critical = 0x0,
    batteryLevel_AlmostEmpty = 0x1,
    batteryLevel_Low = 0x3,
    batteryLevel_Half = 0x7,
    batteryLevel_ThreeQuarters = 0xB,
    batteryLevel_Full = 0xF
    };
    bool GetBatteryCharging() { return Registers[0x20] >> 7; }
    void SetBatteryCharging(bool charging)
    {
    Registers[0x20] = (((charging ? 0x8 : 0x0) << 4) | (Registers[0x20] & 0x0F));
    }
    u8 GetBatteryLevel() { return Registers[0x20] & 0xF; }
    void SetBatteryLevel(u8 batteryLevel)
    {
    Registers[0x20] = ((Registers[0x20] & 0xF0) | (batteryLevel & 0x0F));
    SPI_Powerman::SetBatteryLevelOkay(batteryLevel > batteryLevel_Low ? true : false);
    }
    Battery interface