files/3-rinkhals/opt/rinkhals/patches/K3SysUi.KS1_2.5.6.0.sh
#!/bin/sh

# This script was automatically generated, don't modify it directly
# Before MD5: 3dd4b5aed396761f04d580f64f16d643
# After MD5: 41cd56d715b577800bc9a4ed2e102506

TARGET=$1

MD5=$(md5sum $TARGET | awk '{print $1}')
if [ "$MD5" = "41cd56d715b577800bc9a4ed2e102506" ]; then
    echo $TARGET is already patched, skipping...
    exit 0
fi
if [ "$MD5" != "3dd4b5aed396761f04d580f64f16d643" ]; then
    echo $TARGET hash does not match, skipping patch...
    exit 1
fi

PATCH_FILE=/tmp/patch-$RANDOM.bin
echo 'nDYA6g7woOEvdXNlcmVtYWluL3JpbmtoYWxzLy5jdXJyZW50L29wdC9yaW5raGFscy91aS9yaW5raGFscy11aS5zaCAmIGVjaG8gJCEgPiAvdG1wL3JpbmtoYWxzL3JpbmtoYWxzLXVpLnBpZAB0aW1lb3V0IC10IDIgc3RyYWNlIC1xcXEgLWV0cmFjZT1ub25lIC1wICQoY2F0IC90bXAvcmlua2hhbHMvcmlua2hhbHMtdWkucGlkKSAyPiAvZGV2L251bGxybSAtZiAvdG1wL3JpbmtoYWxzL3JpbmtoYWxzLXVpLnBpZAAEAKDhAwBT41/J/xoAAJ/lAADqRPcSADz4++tkAPIH/OsAAJ/lAAAA6qr3EgA2+PsPAFDj9///CgAAAAAA6gb4EgAw+PvrEAAb5QAAkOUEIKDjARCg47Kx/usQABvlAJDlBBCg442z/utGyf/qUmlua2hhbHMA' | base64 -d > $PATCH_FILE

dd if=$PATCH_FILE skip=0 ibs=1 of=$TARGET seek=1121716 obs=1 count=4 conv=notrunc # 0x111db4 / 0x121db4 > 0x9c3600ea
dd if=$PATCH_FILE skip=4 ibs=1 of=$TARGET seek=1177408 obs=1 count=133 conv=notrunc # 0x11f740 / 0x12f740 > 0x0ef0a0e12f75736572656d61696e2f72696e6b68616c732f2e63757272656e742f6f70742f72696e6b68616c732f75692f72696e6b68616c732d75692e73682026206563686f202421203e202f746d702f72696e6b68616c732f72696e6b68616c732d75692e7069640074696d656f7574202d74203220737472616365202d717171202d65
dd if=$PATCH_FILE skip=137 ibs=1 of=$TARGET seek=1177542 obs=1 count=63 conv=notrunc # 0x11f7c6 / 0x12f7c6 > 0x74726163653d6e6f6e65202d70202428636174202f746d702f72696e6b68616c732f72696e6b68616c732d75692e7069642920323e202f6465762f6e756c6c
dd if=$PATCH_FILE skip=200 ibs=1 of=$TARGET seek=1177606 obs=1 count=36 conv=notrunc # 0x11f806 / 0x12f806 > 0x726d202d66202f746d702f72696e6b68616c732f72696e6b68616c732d75692e70696400
dd if=$PATCH_FILE skip=236 ibs=1 of=$TARGET seek=1177644 obs=1 count=17 conv=notrunc # 0x11f82c / 0x12f82c > 0x0400a0e1030053e35fc9ff1a00009fe500
dd if=$PATCH_FILE skip=253 ibs=1 of=$TARGET seek=1177662 obs=1 count=12 conv=notrunc # 0x11f83e / 0x12f83e > 0x00ea44f712003cf8fbeb6400
dd if=$PATCH_FILE skip=265 ibs=1 of=$TARGET seek=1177676 obs=1 count=19 conv=notrunc # 0x11f84c / 0x12f84c > 0xf207fceb00009fe5000000eaaaf7120036f8fb
dd if=$PATCH_FILE skip=284 ibs=1 of=$TARGET seek=1177696 obs=1 count=10 conv=notrunc # 0x11f860 / 0x12f860 > 0x0f0050e3f7ffff0a0000
dd if=$PATCH_FILE skip=294 ibs=1 of=$TARGET seek=1177708 obs=1 count=37 conv=notrunc # 0x11f86c / 0x12f86c > 0x000000ea06f8120030f8fbeb10001be5000090e50420a0e30110a0e3b2b1feeb10001be500
dd if=$PATCH_FILE skip=331 ibs=1 of=$TARGET seek=1177746 obs=1 count=14 conv=notrunc # 0x11f892 / 0x12f892 > 0x90e50410a0e38db3feeb46c9ffea
dd if=$PATCH_FILE skip=345 ibs=1 of=$TARGET seek=2846480 obs=1 count=9 conv=notrunc # 0x2b6f10 / 0x2c6f10 > 0x52696e6b68616c7300

rm $PATCH_FILE
