first compiling version
authornotaz <notasas@gmail.com>
Sun, 10 Nov 2013 00:46:42 +0000 (02:46 +0200)
committernotaz <notasas@gmail.com>
Sun, 10 Nov 2013 00:47:30 +0000 (02:47 +0200)
runimp.sh [new file with mode: 0755]
runsed.sh [new file with mode: 0755]
uni.inc [new file with mode: 0644]

diff --git a/runimp.sh b/runimp.sh
new file mode 100755 (executable)
index 0000000..25086c7
--- /dev/null
+++ b/runimp.sh
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+grep 'extrn ' StarCraft.asm | awk '{print $2}' | awk -F: '{print $1}' > implist
+
+echo -n "" > tramp.s
+
+cat implist | while read i; do
+  rm -f tmpsym
+  case $i in
+  __imp_*)
+    si=`echo $i | cut -c 7-`
+    ;;
+  *)
+    si=$i
+    ;;
+  esac
+
+  grep "\<_$si\>" /usr/i586-mingw32msvc/lib/lib* | awk '{print $3}' | \
+    while read f; do
+      sym=`i586-mingw32msvc-nm $f | grep "\<_$si\>" | grep ' T ' | awk '{print $3}'`
+      if test -n "$sym"; then
+        echo $sym > tmpsym
+        break
+      fi
+    done
+  sym=`cat tmpsym`
+  if test -z "$sym"; then
+    echo "no file/sym for $i, lf $f"
+    exit 1
+  fi
+
+  echo ".globl $i" >> tramp.s
+  echo "$i:" >> tramp.s
+  echo "  jmp $sym" >> tramp.s
+  echo >> tramp.s
+done
diff --git a/runsed.sh b/runsed.sh
new file mode 100755 (executable)
index 0000000..c2821ba
--- /dev/null
+++ b/runsed.sh
@@ -0,0 +1,21 @@
+#!/bin/sh -x
+
+# sed -i -e '/.model flat/i\
+# \t\t.xmm\r' StarCraft.asm
+
+usyms="copy_start ___from_strstr_to_strchr unknown_libname_36 unknown_libname_41 unknown_libname_58"
+
+f=/tmp/sedcmd_
+echo -n "sed -i -e '/.model flat/i\\\t\t.xmm\r' -e '" > $f
+for sym in $usyms; do
+  echo -n "s/^\<$sym\>:\([^:]\)/$sym::\1/g;" >> $f
+done
+
+echo "\
+s/^\(loc[r_].*[0-9A-F]:\)[^:]\(.*\;\)/\1:\t\2/g;\
+s/dd[[:blank:]]rva/dd/;\
+s/\<fldcw\>\t\[esp+4+var_4\]/fldcw\tword ptr \[esp\]/;\
+s/\<large \(.*fs:\)/\1/;\
+' StarCraft.asm" >> $f
+. $f
+
diff --git a/uni.inc b/uni.inc
new file mode 100644 (file)
index 0000000..e69de29