Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am lucab on github.
  • I am lucab (https://keybase.io/lucab) on keybase.
  • I have a public key whose fingerprint is 7478 5B72 8B8A B530 C60B F303 46AA 1B6A 3BFB 9FB3

To claim this, I am signing this object:

@lucab
lucab / mame.diff
Created January 18, 2015 15:37
mame-lua presave/postload callbacks
commit 380a02907ff0e082cc5291b23882de10e9fbae58
Author: Luca Bruno <lucab@debian.org>
Date: Sun Jan 18 16:28:09 2015 +0100
save: factor-out presave/postload dispatchers
Signed-off-by: Luca Bruno <lucab@debian.org>
diff --git a/src/emu/save.c b/src/emu/save.c
index d7d8ba5..98c23ca 100644
@lucab
lucab / gist:8302e6ef7f88827fb093
Created January 24, 2015 15:23
llvm35-assert.log
$ make
cfg: build triple x86_64-unknown-linux-gnu
cfg: host triples x86_64-unknown-linux-gnu
cfg: target triples x86_64-unknown-linux-gnu
cfg: enabling more debugging (CFG_ENABLE_DEBUG)
cfg: host for x86_64-unknown-linux-gnu is x86_64
cfg: os for x86_64-unknown-linux-gnu is unknown-linux-gnu
cfg: good valgrind for x86_64-unknown-linux-gnu is 1
cfg: using CC=gcc (CFG_CC)
cfg: enabling valgrind run-pass tests (CFG_ENABLE_VALGRIND_RPASS)
@lucab
lucab / hud-101.lua
Created January 29, 2015 22:39
mame lua - HUD drawing
-- enumerate screens
-- (main screen is often tagged as ":screen")
for i,v in pairs(manager:machine().screens) do print(i) end;
-- print main screen width/height
print(manager:machine().screens[":screen"]:width())
print(manager:machine().screens[":screen"]:height())
-- draw stuff on main screen: text, line, box
-- (all colors are in argb format)
@lucab
lucab / OpenPCD2 vTROOPERS15
Created April 8, 2015 20:11
OpenPCD2 vTROOPERS15
$ apt-cache policy libnfc-bin
Installed: 1.7.1-2
*** 1.7.1-2 0
500 http://ftp.de.debian.org/debian/ jessie/main amd64 Packages
$ LIBNFC_DEFAULT_DEVICE="pn532_uart:/dev/ttyACM1" nfc-scan-device
nfc-scan-device uses libnfc 1.7.1
@lucab
lucab / draw_text-workaround.lua
Created April 14, 2015 06:45
Workaround large X values in MAME draw_text()
function main()
camx = band(mem:read_i16(0x2034E2),0xFF80)/0x80
--Sprites
--spradr 0x20869A, 72 offset
adr = 0x20869A - 0x72
for a = 0,0x60,1 do
adr = adr + 0x72
local active = band(mem:read_u8(adr),0x80)/0x80
local y = band(mem:read_i16(adr + 0x2A),0xFF80)/0x80
@lucab
lucab / draw_text-fix.diff
Created April 17, 2015 22:10
Fix infinite loop while word-wrapping string in draw_text()
diff --git a/src/emu/ui/ui.c b/src/emu/ui/ui.c
index c3041a7..0eee040 100644
--- a/src/emu/ui/ui.c
+++ b/src/emu/ui/ui.c
@@ -694,6 +694,9 @@ void ui_manager::draw_text_full(render_container *container, const char *origs,
break;
curwidth -= get_font()->char_width(lineheight, aspect, schar);
+ // if back to 0, there is no space to draw even a single char
+ if (curwidth <= 0)
diff --git a/src/unix/linux-core.c b/src/unix/linux-core.c
index 11a67eb..b96b44d 100644
--- a/src/unix/linux-core.c
+++ b/src/unix/linux-core.c
@@ -33,6 +33,7 @@
#include <sys/prctl.h>
#include <sys/sysinfo.h>
#include <unistd.h>
+#include <signal.h>
#include <fcntl.h>
Index: llvm-3.2.src/clang/lib/Driver/ToolChains.cpp
===================================================================
--- llvm-3.2.src.orig/clang/lib/Driver/ToolChains.cpp 2013-01-18 15:57:25.240901367 +0100
+++ llvm-3.2.src/clang/lib/Driver/ToolChains.cpp 2013-01-18 15:57:49.752900485 +0100
@@ -36,6 +36,9 @@
#include <cstdlib> // ::getenv
#include "clang/Config/config.h" // for GCC_INSTALL_PREFIX
+#include <iostream>
@lucab
lucab / git-subtree-debian.sh
Created November 28, 2013 11:06
Enable git-subtree from Debian git package (>= 1.7.11)
sudo cp git-subtree.sh "$(git --exec-path)"/git-subtree
sudo chmod a+x "$(git --exec-path)"/git-subtree