Skip to content

Commit

Permalink
Add support for Battle Isle 3
Browse files Browse the repository at this point in the history
  • Loading branch information
M-HT committed Jun 27, 2021
1 parent 35e9ee9 commit 6a67dcd
Show file tree
Hide file tree
Showing 225 changed files with 33,215 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Following DOS games are supported:
Following Windows games are supported:

* [Septerra Core: Legacy of the Creator](https://en.wikipedia.org/wiki/Septerra_Core "Septerra Core: Legacy of the Creator")
* [Battle Isle 3: Shadow of the Emperor (Battle Isle 2220: Shadow of the Emperor)](https://en.wikipedia.org/wiki/Battle_Isle_2220 "Battle Isle 3: Shadow of the Emperor (Battle Isle 2220: Shadow of the Emperor)")

The source code is released with MIT license (except libraries, etc. by other people, which have their own license).
For the purpose of using the code in GPL projects, the source code is also released with GPLv2 or later and LGPLv2.1 or later.
Expand All @@ -37,11 +38,11 @@ The projects consists of following subprojects (read the readmes in subproject d
* **games**
* Game specific source code.
* Together with the generated assembler versions of the executables, these files can be used to build Windows or Linux (x86 or arm) versions of the games.
* Uses plugins to play (or play better) music (in DOS games).
* Uses plugins to play (or play better) music.
* **midi-libs**
* Libraries that are used by plugins in *midi-plugins* subproject to play MIDI music.
* **midi-plugins**
* Plugins used by the DOS games to play MIDI (and other types) music.
* Plugins used by the games to play MIDI (and other types) music.
* **scaler-plugins**
* Plugins used by the DOS games to enlarge/enhance the displayed image.
* **pycfg**
Expand Down
2 changes: 2 additions & 0 deletions SRW-games/Battle Isle 3/SRW-ms_figtr/SR.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
esp_dword_aligned=yes
ebp_dword_aligned=yes
7 changes: 7 additions & 0 deletions SRW-games/Battle Isle 3/SRW-ms_figtr/build-llasm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#! /bin/sh
cd "`echo $0 | sed 's/\/[^\/]*$//'`"
cp llasm/*.sci ./
./SRW.exe MS_FIGTR.DLL MS_FIGTR.llasm >a.a 2>b.a
rm *.sci
./compact_source_llasm.py
rm *.a
8 changes: 8 additions & 0 deletions SRW-games/Battle Isle 3/SRW-ms_figtr/build-x86.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /bin/sh
cd "`echo $0 | sed 's/\/[^\/]*$//'`"
cp x86/*.sci ./
./SRW.exe MS_FIGTR.DLL MS_FIGTR.asm >a.a 2>b.a
rm *.sci
./compact_source.py
rm *.a
rm MS_FIGTR.def
61 changes: 61 additions & 0 deletions SRW-games/Battle Isle 3/SRW-ms_figtr/compact_source.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#! /usr/bin/python
cPath = "./"

import os

def Compact (cFile):
cTmpFile = cFile + "tmp"
fIn = open(cFile, "rt")
fOut = open(cTmpFile, "wt")

iNum = 0
cRepStr = ""

for cLine in fIn:
if iNum != 0:
if cLine == cRepStr:
iNum = iNum + 1
else:
if iNum == 1:
fOut.write(cRepStr)
elif cRepStr.startswith("resb"):
fOut.write("resb " + str(iNum) + "\n")
elif iNum == 2:
fOut.write(cRepStr)
fOut.write(cRepStr)
else:
fOut.write("times " + str(iNum) + " " + cRepStr)
iNum = 0
#cRepStr = ""

if iNum == 0:
if cLine.startswith("db "):
iNum = 1
cRepStr = cLine
elif cLine.strip() == "resb 1":
iNum = 1
cRepStr = cLine
else:
fOut.write(cLine)

if iNum != 0:
if iNum == 1:
fOut.write(cRepStr)
elif cRepStr.startswith("resb"):
fOut.write("resb " + str(iNum) + "\n")
elif iNum == 2:
fOut.write(cRepStr)
fOut.write(cRepStr)
else:
fOut.write("times " + str(iNum) + " " + cRepStr)

fOut.close()
fIn.close()

os.remove(cFile)
os.rename(cTmpFile, cFile)

Compact(cPath + "seg01.inc")
Compact(cPath + "seg02.inc")
Compact(cPath + "seg03.inc")
Compact(cPath + "seg04.inc")
61 changes: 61 additions & 0 deletions SRW-games/Battle Isle 3/SRW-ms_figtr/compact_source_llasm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#! /usr/bin/python
cPath = "./"

import os

def Compact (cFile):
cTmpFile = cFile + "tmp"
fIn = open(cFile, "rt")
fOut = open(cTmpFile, "wt")

iNum = 0
cRepStr = ""

for cLine in fIn:
if iNum != 0:
if cLine == cRepStr:
iNum = iNum + 1
else:
if iNum == 1:
fOut.write(cRepStr)
elif cRepStr.startswith("dskip"):
fOut.write("dskip " + str(iNum) + "\n")
elif iNum == 2:
fOut.write(cRepStr)
fOut.write(cRepStr)
else:
fOut.write(cRepStr.rstrip() + " dup " + str(iNum) + cRepStr[len(cRepStr.rstrip()):])
iNum = 0
#cRepStr = ""

if iNum == 0:
if cLine.startswith("db "):
iNum = 1
cRepStr = cLine
elif cLine.strip() == "dskip 1":
iNum = 1
cRepStr = cLine
elif iNum == 2:
fOut.write(cRepStr)
fOut.write(cRepStr)
else:
fOut.write(cLine)

if iNum != 0:
if iNum == 1:
fOut.write(cRepStr)
elif cRepStr.startswith("dskip"):
fOut.write("dskip " + str(iNum) + "\n")
else:
fOut.write(cRepStr.rstrip() + " dup " + str(iNum) + cRepStr[len(cRepStr.rstrip()):])

fOut.close()
fIn.close()

os.remove(cFile)
os.rename(cTmpFile, cFile)

Compact(cPath + "seg01_data.llinc")
Compact(cPath + "seg02_data.llinc")
Compact(cPath + "seg03_data.llinc")
Compact(cPath + "seg04_data.llinc")
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
loc_10004600,ms_strcpy_asm2c
loc_10004690,ms_strlen_asm2c
loc_100046e0,ms_memcpy_asm2c
loc_10004830,ms_memset_asm2c
loc_10004874,ms__ftol_asm2c
loc_10007C36,ms__ltoa_asm2c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loc_10004EB8
15 changes: 15 additions & 0 deletions SRW-games/Battle Isle 3/SRW-ms_figtr/llasm/ignored_areas.sci
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
loc_100013D7,11

loc_10004507,46

loc_100045EE,14
loc_100045FC,14468

loc_10009554,12

loc_100095DC,788

loc_1000B2D8,3452
loc_1000C054,4012

loc_10008D20,28
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
loc_100016B4,13,tcall loc_100016C1|endp ; unused stock object
loc_10001832,12,tcall loc_1000183E|endp ; unused stock object
loc_1000B01C,28, ; unused stock object

loc_100027BE,71, ; unused device context
loc_10002B74,18, ; unused device context
loc_10008D80,4, ; unused device context
loc_1000B284,32, ; unused device context

loc_1000277E,64, ; unused window handle
loc_100045BE,6, ; unused window handle
loc_10008D84,4, ; unused window handle
loc_1000B264,32, ; unused window handle

loc_10001510,6,;call __Fight|PUSH loc_10001510_after|tcall __Fight|endp|proc loc_10001510_after ; call __Fight directly
loc_100017BE,6,;call __Fight|PUSH loc_100017BE_after|tcall __Fight|endp|proc loc_100017BE_after ; call __Fight directly
loc_10002B26,6,;call __Fight|PUSH loc_10002B26_after|tcall __Fight|endp|proc loc_10002B26_after ; call __Fight directly

loc_10001487,83, ; remove dynamic load of __Fight
loc_1000B00C,4, ; remove dynamic load of __Fight
loc_1000B164,32, ; remove dynamic load of __Fight

loc_10001450,55, ; remove dynamic load of wc_figtr.dll
loc_1000158B,12, ; remove dynamic load of wc_figtr.dll
loc_100015FD,12, ; remove dynamic load of wc_figtr.dll
loc_1000180C,25, ; remove dynamic load of wc_figtr.dll
loc_10002AC5,12, ; remove dynamic load of wc_figtr.dll
loc_1000B008,4, ; remove dynamic load of wc_figtr.dll
loc_1000B134,48, ; remove dynamic load of wc_figtr.dll

loc_10003FF2,63,;push eax|PUSH eax|;call FGT_SystemTask_End_asm2c|PUSH loc_10003FF2_after|tcall FGT_SystemTask_End_asm2c|endp|proc loc_10003FF2_after ; replace end of function FGT_SystemTask
loc_10004036,49,;push dword 0|PUSH 0|;call FGT_SystemTask_End_asm2c|PUSH loc_10004036_after|tcall FGT_SystemTask_End_asm2c|endp|proc loc_10004036_after|tcall loc_10004067|endp ; replace end of function FGT_SystemTask

loc_10002C1B,5,;push dword 0|PUSH 0|;call FGT_CheckTicksDelay_asm2c|PUSH loc_10002C1B_after1|tcall FGT_CheckTicksDelay_asm2c|endp|proc loc_10002C1B_after1|;call SYSTEM_GetTicks|PUSH loc_10002C1B_after2|tcall SYSTEM_GetTicks|endp|proc loc_10002C1B_after2 ; insert delays into active waiting
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
loc_10004600,ms_strcpy_asm2c
loc_10004690,ms_strlen_asm2c
loc_100046e0,ms_memcpy_asm2c
loc_10004830,ms_memset_asm2c
loc_10004874,ms__ftol_asm2c
loc_10007C36,ms__ltoa_asm2c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
loc_10004EB8
15 changes: 15 additions & 0 deletions SRW-games/Battle Isle 3/SRW-ms_figtr/x86/ignored_areas.sci
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
loc_100013D7,11

loc_10004507,46

loc_100045EE,14
loc_100045FC,14468

loc_10009554,12

loc_100095DC,788

loc_1000B2D8,3452
loc_1000C054,4012

loc_10008D20,28
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
loc_100016B4,13, ; unused stock object
loc_10001832,12, ; unused stock object
loc_1000B01C,28, ; unused stock object

loc_100027BE,71, ; unused device context
loc_10002B74,18, ; unused device context
loc_10008D80,4, ; unused device context
loc_1000B284,32, ; unused device context

loc_1000277E,64, ; unused window handle
loc_100045BE,6, ; unused window handle
loc_10008D84,4, ; unused window handle
loc_1000B264,32, ; unused window handle

loc_10001510,6,call __Fight ; call __Fight directly
loc_100017BE,6,call __Fight ; call __Fight directly
loc_10002B26,6,call __Fight ; call __Fight directly

loc_10001487,83, ; remove dynamic load of __Fight
loc_1000B00C,4, ; remove dynamic load of __Fight
loc_1000B164,32, ; remove dynamic load of __Fight

loc_10001450,55, ; remove dynamic load of wc_figtr.dll
loc_1000158B,12, ; remove dynamic load of wc_figtr.dll
loc_100015FD,12, ; remove dynamic load of wc_figtr.dll
loc_1000180C,25, ; remove dynamic load of wc_figtr.dll
loc_10002AC5,12, ; remove dynamic load of wc_figtr.dll
loc_1000B008,4, ; remove dynamic load of wc_figtr.dll
loc_1000B134,48, ; remove dynamic load of wc_figtr.dll

loc_10003FF2,63,push eax|call FGT_SystemTask_End_asm2c ; replace end of function FGT_SystemTask
loc_10004036,49,push dword 0|call FGT_SystemTask_End_asm2c ; replace end of function FGT_SystemTask

loc_10002C1B,5,push dword 0|call FGT_CheckTicksDelay_asm2c|call SYSTEM_GetTicks ; insert delays into active waiting
2 changes: 2 additions & 0 deletions SRW-games/Battle Isle 3/SRW-sdi_1r/SR.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
esp_dword_aligned=yes
ebp_dword_aligned=yes
8 changes: 8 additions & 0 deletions SRW-games/Battle Isle 3/SRW-sdi_1r/build-llasm.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /bin/sh
cd "`echo $0 | sed 's/\/[^\/]*$//'`"
cp llasm/*.sci ./
./SRW.exe SDI_1R.EXE SDI_1R.llasm >a.a 2>b.a
rm *.sci
./compact_source_llasm.py
rm *.a
rm SDI_1R.resdump
8 changes: 8 additions & 0 deletions SRW-games/Battle Isle 3/SRW-sdi_1r/build-x86.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#! /bin/sh
cd "`echo $0 | sed 's/\/[^\/]*$//'`"
cp x86/*.sci ./
./SRW.exe SDI_1R.EXE SDI_1R.asm >a.a 2>b.a
rm *.sci
./compact_source.py
rm *.a
rm SDI_1R.resdump SDI_1R.def
61 changes: 61 additions & 0 deletions SRW-games/Battle Isle 3/SRW-sdi_1r/compact_source.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#! /usr/bin/python
cPath = "./"

import os

def Compact (cFile):
cTmpFile = cFile + "tmp"
fIn = open(cFile, "rt")
fOut = open(cTmpFile, "wt")

iNum = 0
cRepStr = ""

for cLine in fIn:
if iNum != 0:
if cLine == cRepStr:
iNum = iNum + 1
else:
if iNum == 1:
fOut.write(cRepStr)
elif cRepStr.startswith("resb"):
fOut.write("resb " + str(iNum) + "\n")
elif iNum == 2:
fOut.write(cRepStr)
fOut.write(cRepStr)
else:
fOut.write("times " + str(iNum) + " " + cRepStr)
iNum = 0
#cRepStr = ""

if iNum == 0:
if cLine.startswith("db "):
iNum = 1
cRepStr = cLine
elif cLine.strip() == "resb 1":
iNum = 1
cRepStr = cLine
else:
fOut.write(cLine)

if iNum != 0:
if iNum == 1:
fOut.write(cRepStr)
elif cRepStr.startswith("resb"):
fOut.write("resb " + str(iNum) + "\n")
elif iNum == 2:
fOut.write(cRepStr)
fOut.write(cRepStr)
else:
fOut.write("times " + str(iNum) + " " + cRepStr)

fOut.close()
fIn.close()

os.remove(cFile)
os.rename(cTmpFile, cFile)

Compact(cPath + "seg01.inc")
Compact(cPath + "seg02.inc")
Compact(cPath + "seg03.inc")
Compact(cPath + "seg04.inc")
Loading

0 comments on commit 6a67dcd

Please sign in to comment.