-
Notifications
You must be signed in to change notification settings - Fork 1
/
build-win32.lisp
50 lines (41 loc) · 2.31 KB
/
build-win32.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;;; Deliver the program using allegro common lisp on win32
(in-package :cl-user)
(require :asdf)
(defvar *dll-pathname* #p"c:/Users/Sandy/xe2/")
(defvar *game* "xiotank")
(defvar *executable* #p"c:/Users/Sandy/xe2/app.exe")
(defvar *base-pathname* (make-pathname :name nil :type nil :defaults *load-pathname*))
(pushnew (translate-pathname *base-pathname* "**/" "**/site/cffi_0.10.3/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/babel_0.3.0/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/alexandria/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/trivial-features_0.4/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/rt-20040621/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/lispbuilder/lispbuilder-sdl/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/lispbuilder/lispbuilder-sdl-image/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/lispbuilder/lispbuilder-sdl-mixer/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/site/lispbuilder/lispbuilder-sdl-gfx/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/clon/") asdf:*central-registry*)
(pushnew (translate-pathname *base-pathname* "**/" "**/xe2/") asdf:*central-registry*)
(asdf:oos 'asdf:load-op :cffi)
(require 'sb-posix)
(sb-posix:chdir *dll-pathname*)
;;(setf *default-pathname-defaults* (make-pathname :directory '(:relative)))
(asdf:oos 'asdf:load-op :xe2)
(pop cffi:*foreign-library-directories*)
(defun main ()
(setf xe2:*module-directories* (list (make-pathname :directory '(:relative))))
(xe2:play *game*)
0)
(sb-ext:save-lisp-and-die *executable* :toplevel #'main :executable t)
;; TODO try this to get rid of the kitten of death
;; (with-open-file (exe #p"path/to/game.exe" :direction :io :element-type '(unsigned-byte 8))
;; (file-position exe #x3c)
;; (let* ((b0 (read-byte exe))
;; (b1 (read-byte exe))
;; (b2 (read-byte exe))
;; (b3 (read-byte exe))
;; (pe-header (dpb (dpb b3 (byte 8 8) b2)
;; (byte 16 16)
;; (dpb b1 (byte 8 8) b0))))
;; (file-position exe (+ pe-header #x5c))
;; (write-byte 3 exe)))