mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-18 12:09:10 +00:00
Compare commits
269 Commits
1.4.0-beta
...
1.4.4-RC1
Author | SHA1 | Date | |
---|---|---|---|
|
46ba435529 | ||
|
7fcd735ebc | ||
|
28bc11a9f1 | ||
|
2147c81162 | ||
|
ee3f8c3ef2 | ||
|
628b52921f | ||
|
cac97612ac | ||
|
4bd5dcb3b4 | ||
|
c37b98b58b | ||
|
b0425dbdc5 | ||
|
9d34dbf080 | ||
|
57f6cb970b | ||
|
6043b839af | ||
|
45bb3caba2 | ||
|
126b11db63 | ||
|
2134c2e905 | ||
|
8e36fb0ada | ||
|
12c3ba3095 | ||
|
0db873d6da | ||
|
17507b217c | ||
|
48bd683010 | ||
|
3614c4447f | ||
|
3630a2cc4e | ||
|
26ed360ccd | ||
|
8dc0522434 | ||
|
13378995d9 | ||
|
1708243e51 | ||
|
324e17d827 | ||
|
bcfc0ec957 | ||
|
5702b3951c | ||
|
491b3e3efc | ||
|
2759e32451 | ||
|
d3c41a9d0e | ||
|
3cd96a459b | ||
|
1d18ef48a4 | ||
|
a6e95ace5c | ||
|
c57b316570 | ||
|
b720a16a1c | ||
|
7a0b2bff18 | ||
|
34bff06d8a | ||
|
be4eae9456 | ||
|
f8b956bc2c | ||
|
42c7cb38fa | ||
|
9d2f06c42c | ||
|
0c2be35fa1 | ||
|
80a3b5e78f | ||
|
8ca5334562 | ||
|
d470955e40 | ||
|
c18ccfe0de | ||
|
2e7230dc2b | ||
|
a7f5ff3f73 | ||
|
7ff5066904 | ||
|
2febdda8df | ||
|
e73cd7e81d | ||
|
e031a86d69 | ||
|
ae23f519f7 | ||
|
51501be48f | ||
|
d0356725f6 | ||
|
5d3fcce725 | ||
|
aee9444c1b | ||
|
7a126a20ea | ||
|
72f6c1b4bf | ||
|
b816e07742 | ||
|
6b61c4608f | ||
|
b935cb8415 | ||
|
363d5e8205 | ||
|
2b0863d2b0 | ||
|
d0aa98ef7d | ||
|
8e8cf213bd | ||
|
20970da24a | ||
|
34cd77dcf5 | ||
|
fc818d1373 | ||
|
33206425c0 | ||
|
2b3d87d7e6 | ||
|
90892cb66f | ||
|
a9acaf7a5e | ||
|
62b22bfd2b | ||
|
408b5a70af | ||
|
440168cfb2 | ||
|
a32d18cbb9 | ||
|
c6ce57e8a7 | ||
|
e9f7103ad7 | ||
|
5fa2a6faec | ||
|
e15446bc58 | ||
|
d8eda06a5a | ||
|
b4a015a4bd | ||
|
2b10ee1891 | ||
|
98539bd2c3 | ||
|
90fef59f80 | ||
|
7bdd67e701 | ||
|
aaa6d0f9ae | ||
|
9b9a21f044 | ||
|
cbacd70aa9 | ||
|
9479963b3b | ||
|
f7ba7f34f2 | ||
|
1fcb3bd1f1 | ||
|
ce1719e722 | ||
|
ac2cd315ef | ||
|
3e78c4dc7b | ||
|
27eede06c9 | ||
|
fe03ab06e5 | ||
|
7ac18c0f22 | ||
|
b2ca2e2979 | ||
|
cc77d40336 | ||
|
55502341ac | ||
|
20785c79fc | ||
|
40f61eaf15 | ||
|
46590e112e | ||
|
dc0f89b7e9 | ||
|
2945e76269 | ||
|
997b2634c5 | ||
|
7d56fd5382 | ||
|
4055397915 | ||
|
4a00552a09 | ||
|
4c11bddb3a | ||
|
bd54155cb6 | ||
|
cb7544ea39 | ||
|
858e80f3dd | ||
|
470bd0ce24 | ||
|
e37656f2e5 | ||
|
82ece7db12 | ||
|
4f24e33548 | ||
|
03169121c2 | ||
|
88787412b6 | ||
|
a4941e759c | ||
|
20737a3462 | ||
|
83a202ea46 | ||
|
e4c7c8876b | ||
|
77e62f0b98 | ||
|
202f21f262 | ||
|
75504d24bf | ||
|
4cbab4f744 | ||
|
2925a9005b | ||
|
41b7a04a68 | ||
|
50c6b2486b | ||
|
2e598be48f | ||
|
167f232623 | ||
|
9f6b8aea49 | ||
|
c7629735a3 | ||
|
d05ff6e77b | ||
|
fcb122124b | ||
|
f99d380583 | ||
|
30a95966ec | ||
|
9603014102 | ||
|
1dbd59e6ab | ||
|
57a88c9de2 | ||
|
14d99c6961 | ||
|
5165be2698 | ||
|
ebcc8462b7 | ||
|
fa7eb6dc8c | ||
|
425197a19c | ||
|
0c6f22b5c1 | ||
|
cf96168f6f | ||
|
8b003bd133 | ||
|
58dfc54296 | ||
|
9e5fc88499 | ||
|
9ff5aa4b7b | ||
|
c633ee15d2 | ||
|
9dc69d7f4d | ||
|
dda4ffab5e | ||
|
547e521381 | ||
|
1fc589bd2d | ||
|
4fd67347bd | ||
|
91407b924e | ||
|
e4a4f2c1dd | ||
|
9041473814 | ||
|
b12bf124c7 | ||
|
84b8d376b6 | ||
|
61380f51bb | ||
|
87d373e673 | ||
|
5d4c4b9172 | ||
|
cce3d4fec8 | ||
|
f0e7f9982a | ||
|
95354136be | ||
|
932dad7c8b | ||
|
278b380d10 | ||
|
aee9abeab2 | ||
|
c884665cb9 | ||
|
f36d084db5 | ||
|
efe6adba6a | ||
|
5a41423e03 | ||
|
7e91f96b92 | ||
|
b158c7d0fa | ||
|
be62387e44 | ||
|
f373f8a9c2 | ||
|
a5152be795 | ||
|
e3947c8019 | ||
|
1213e6ba71 | ||
|
ef9108bd58 | ||
|
eb2c2ef877 | ||
|
fdf55a1a48 | ||
|
f5f4f8a4b3 | ||
|
3a44e22b1a | ||
|
70901e04c5 | ||
|
2f7c4f6d12 | ||
|
5b3b533697 | ||
|
7f6e837b3a | ||
|
9a90bed79b | ||
|
6e34672c6c | ||
|
76661f2c56 | ||
|
31c6e33878 | ||
|
a942619911 | ||
|
54a898be33 | ||
|
ee5c115950 | ||
|
e9c22ef16f | ||
|
00e7ceeca4 | ||
|
4f419b8f84 | ||
|
ba1779b978 | ||
|
73c6565cf2 | ||
|
477c15383d | ||
|
5ab39cc651 | ||
|
bc86bf9b12 | ||
|
9ad173c9cc | ||
|
8259d279d5 | ||
|
de5f0e9cbb | ||
|
208db963ad | ||
|
6025a52ee9 | ||
|
a05d548fae | ||
|
ce72195cf3 | ||
|
014813141d | ||
|
1aa26b30c7 | ||
|
998049a618 | ||
|
4575420dcc | ||
|
b48bb25288 | ||
|
7b20da8a0a | ||
|
115c712f4e | ||
|
613fb9c6ef | ||
|
9947bdb0c4 | ||
|
e6fc55b07b | ||
|
a325c33578 | ||
|
f480c5a623 | ||
|
1d4565a666 | ||
|
1e1656110a | ||
|
4c84d13454 | ||
|
78df732a7b | ||
|
71a81a8762 | ||
|
fb05674cb7 | ||
|
899c0f9cd2 | ||
|
2618d960e3 | ||
|
456dba4889 | ||
|
b100125866 | ||
|
7247ecf172 | ||
|
3c94485ba0 | ||
|
c98a94da44 | ||
|
256a3160c4 | ||
|
9bf21279f8 | ||
|
fb4db0b022 | ||
|
868a67111b | ||
|
298b003db1 | ||
|
9ee447731a | ||
|
e76d294c10 | ||
|
52c942b177 | ||
|
59ff2836d4 | ||
|
6b3c1aa036 | ||
|
aad80b7536 | ||
|
e3542b1977 | ||
|
8ee152b747 | ||
|
0de65cbf91 | ||
|
2c6aa62bbf | ||
|
ecdd796a86 | ||
|
63b43ed914 | ||
|
c71aa27b92 | ||
|
cab6391ded | ||
|
a178781487 | ||
|
28de2ec68b | ||
|
cc873704ac | ||
|
fb1a5caf9f | ||
|
3bdb4982d7 | ||
|
40bf635a6d |
@@ -75,10 +75,10 @@ $(BIN_DIR)/%.obm: $(BASESET_DIR)/%.obm $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/
|
||||
$(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $< >$@
|
||||
|
||||
# Compile extra grf
|
||||
$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
|
||||
$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites $(GRF_DIR)/assemble_nfo.awk
|
||||
$(E) '$(STAGE) Assembling openttd.nfo'
|
||||
$(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null
|
||||
$(Q) $(CC_BUILD) -nostdinc -I$(GRF_DIR) -C -E - < "$(GRF_DIR)/openttd.nfo" | sed -e '/^#/d' -e '/^$$/d' > $(OBJS_DIR)/sprites/openttd.nfo
|
||||
$(Q) awk -f $(GRF_DIR)/assemble_nfo.awk $(GRF_DIR)/openttd.nfo > $(OBJS_DIR)/sprites/openttd.nfo
|
||||
$(Q) $(NFORENUM) -s $(OBJS_DIR)/sprites/openttd.nfo
|
||||
$(E) '$(STAGE) Compiling openttd.grf'
|
||||
$(Q) $(GRFCODEC) -n -s -e -p1 $(OBJS_DIR)/openttd.grf
|
||||
|
@@ -229,10 +229,22 @@ $(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
|
||||
$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
$(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
|
||||
$(filter-out %sse2.o, $(filter-out %ssse3.o, $(filter-out %sse4.o, $(OBJS_CPP)))): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
$(filter %sse2.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -msse2 -o $@ $<
|
||||
|
||||
$(filter %ssse3.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -mssse3 -o $@ $<
|
||||
|
||||
$(filter %sse4.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -msse4.1 -o $@ $<
|
||||
|
||||
$(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)'
|
||||
$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<
|
||||
|
@@ -10,7 +10,7 @@ fallback = true
|
||||
description = A music pack without actual music.
|
||||
description.af_ZA = 'n Musiek stel sonder enige musiek.
|
||||
description.ar_EG = مجموعة موسيقى بدون موسيقى
|
||||
description.be_BY = "Пусты" набор музычнага афармлення, не змяшчаючы ніякай музыкі.
|
||||
description.be_BY = "Пусты" набор музычнага афармлення, які не зьмяшчае ніякай музыкі.
|
||||
description.bg_BG = Празен музикален пакет.
|
||||
description.ca_ES = Un joc de música sense cap música.
|
||||
description.cs_CZ = Prázná hudební sada.
|
||||
|
@@ -10,7 +10,7 @@ fallback = true
|
||||
description = A sound pack without any sounds.
|
||||
description.af_ZA = 'n Klank stel sonder enige klanke.
|
||||
description.ar_EG = مجموعة صوت بدوت اصوات مضافة
|
||||
description.be_BY = "Пусты" набор гукавога афармленьня, не змяшчаючы ніякіх гукаў.
|
||||
description.be_BY = "Пусты" набор гукавога афармленьня, які не зьмяшчае ніякіх гукаў.
|
||||
description.bg_BG = Празен звуков пакет.
|
||||
description.ca_ES = Un joc de sons sense cap so.
|
||||
description.cs_CZ = Prázdná sada zvuků.
|
||||
@@ -22,6 +22,7 @@ description.en_AU = A sound pack without any sounds.
|
||||
description.en_US = A sound pack without any sounds.
|
||||
description.es_ES = Un conjunto de sonidos vacío.
|
||||
description.et_EE = Helikogu ilma helideta.
|
||||
description.eu_ES = Soinurik gabeko soinu pakete bat
|
||||
description.fi_FI = Äänipaketti, jossa ei ole ääniä.
|
||||
description.fr_FR = Un pack de sons sans sons.
|
||||
description.gd_GB = Pacaid fhuaimean anns nach eil fuaim sam bith.
|
||||
|
Binary file not shown.
@@ -11,7 +11,7 @@ palette = DOS
|
||||
description = Original Transport Tycoon Deluxe DOS edition graphics.
|
||||
description.af_ZA = Oorspronklike Transport Tycoon Deluxe DOS uitgawe grafieke.
|
||||
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الرسومية نسخة الدوس
|
||||
description.be_BY = Арыгінальная графіка з Transport Tycoon Deluxe для DOS.
|
||||
description.be_BY = Арыґінальная ґрафіка з Transport Tycoon Deluxe для DOS.
|
||||
description.bg_BG = Оригинални графики на Transport Tycoon Deluxe за DOS.
|
||||
description.ca_ES = Gràfics originals de Transport Tycoon Deluxe per a DOS.
|
||||
description.cs_CZ = Původní sada grafik Transport Tycoon Deluxe (verze pro DOS).
|
||||
|
@@ -10,7 +10,7 @@ version = 0
|
||||
description = Original Transport Tycoon Deluxe DOS edition sounds.
|
||||
description.af_ZA = Oorspronklike Transport Tycoon Deluxe DOS uitgawe klanke.
|
||||
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الصوتية نسخة الدوس
|
||||
description.be_BY = Арыгінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для DOS.
|
||||
description.be_BY = Арыґінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для DOS.
|
||||
description.bg_BG = Оригинални звуци на Transport Tycoon Deluxe за DOS.
|
||||
description.ca_ES = Sons originals de Transport Tycoon Deluxe per a DOS.
|
||||
description.cs_CZ = Původní sada zvuků Transport Tycoon Deluxe (verze pro DOS).
|
||||
|
@@ -11,7 +11,7 @@ palette = DOS
|
||||
description = Original Transport Tycoon Deluxe DOS (German) edition graphics.
|
||||
description.af_ZA = Oorspronklike Transport Tycoon Deluxe DOS (German) uitgawe grafieke.
|
||||
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الالمانية نسخة الدوس
|
||||
description.be_BY = Арыгінальная графіка з нямецкай версіі Transport Tycoon Deluxe для DOS.
|
||||
description.be_BY = Арыґінальная ґрафіка зь нямецкай версіі Transport Tycoon Deluxe для DOS.
|
||||
description.bg_BG = Оригинални графики на Transport Tycoon Deluxe за DOS (немски) .
|
||||
description.ca_ES = Gràfics originals de Transport Tycoon Deluxe per a DOS (Alemany).
|
||||
description.cs_CZ = Původní sada grafik Transport Tycoon Deluxe (německá verze pro DOS).
|
||||
|
@@ -11,7 +11,7 @@ palette = Windows
|
||||
description = Original Transport Tycoon Deluxe Windows edition graphics.
|
||||
description.af_ZA = Oorspronklike Transport Tycoon Deluxe Windows uitgawe grafieke.
|
||||
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الرسومية نسخة وندوز
|
||||
description.be_BY = Арыгінальная графіка з Transport Tycoon Deluxe для Windows.
|
||||
description.be_BY = Арыґінальная ґрафіка з Transport Tycoon Deluxe для Windows.
|
||||
description.bg_BG = Оригинални графики на Transport Tycoon Deluxe за Windows.
|
||||
description.ca_ES = Gràfics originals de Transport Tycoon Deluxe per a Windows.
|
||||
description.cs_CZ = Původní sada grafik Transport Tycoon Deluxe (verze pro Windows).
|
||||
@@ -33,7 +33,7 @@ description.id_ID = Grafik orisinil Transport Tycoon Deluxe versi Windows.
|
||||
description.is_IS = Upprunalega grafíkin úr Transport Tycoon Deluxe Windows útgáfunni.
|
||||
description.it_IT = Grafica originale di Transport Tycoon Deluxe, edizione Windows.
|
||||
description.ja_JP = Transport Tycoon Deluxe オリジナル版 グラフィック (Windows)
|
||||
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도우 에디션의 그래픽입니다.
|
||||
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 그래픽입니다.
|
||||
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Grafik.
|
||||
description.lt_LT = Originali Transport Tycoon Deluxe Windows leidimo grafika.
|
||||
description.nb_NO = Original grafikk fra Transport Tycoon Deluxe for Windows.
|
||||
|
@@ -10,7 +10,7 @@ version = 1
|
||||
description = Original Transport Tycoon Deluxe Windows edition music.
|
||||
description.af_ZA = Oorspronklike Transport Tycoon Deluxe Windows uitgawe musiek.
|
||||
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الموسيقية نسخة وندوز
|
||||
description.be_BY = Арыгінальны набор музычнага афармленьня з гульні Transport Tycoon Deluxe для Windows.
|
||||
description.be_BY = Арыґінальны набор музычнага афармленьня з гульні Transport Tycoon Deluxe для Windows.
|
||||
description.bg_BG = Оригинална музика на Transport Tycoon Deluxe за Windows.
|
||||
description.ca_ES = Música Original de Transport Tycoon Deluxe per a Windows.
|
||||
description.cs_CZ = Původní hudba Transport Tycoon Deluxe (verze pro Windows).
|
||||
@@ -32,7 +32,7 @@ description.id_ID = Musik pengiring orisinil Transport Tycoon Deluxe versi Windo
|
||||
description.is_IS = Upprunalega tónlistin úr Transport Tycoon Deluxe Windows útgáfunni.
|
||||
description.it_IT = Musica originale di Transport Tycoon Deluxe, edizione Windows.
|
||||
description.ja_JP = Transport Tycoon Deluxe オリジナル版 音楽 (Windows)
|
||||
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도우 에디션의 음악입니다.
|
||||
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 음악입니다.
|
||||
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Music.
|
||||
description.lt_LT = Originali Transport Tycoon Deluxe Windows leidimo muzika.
|
||||
description.lv_LV = Oriģinālā Transport Tycoon Deluxe Windows izdevuma mūzika.
|
||||
|
@@ -10,7 +10,7 @@ version = 0
|
||||
description = Original Transport Tycoon Deluxe Windows edition sounds.
|
||||
description.af_ZA = Oorspronklike Transport Tycoon Deluxe Windows uitgawe klanke.
|
||||
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الصوتية نسخة وندوز
|
||||
description.be_BY = Арыгінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для Windows.
|
||||
description.be_BY = Арыґінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для Windows.
|
||||
description.bg_BG = Оригинални звуци на Transport Tycoon Deluxe за Windows.
|
||||
description.ca_ES = Sons originals de Transport Tycoon Deluxe per a Windows.
|
||||
description.cs_CZ = Původní sada zvuků Transport Tycoon Deluxe (verze pro Windows).
|
||||
@@ -32,7 +32,7 @@ description.id_ID = Efek suara orisinil Transport Tycoon Deluxe versi Windows.
|
||||
description.is_IS = Upprunalega hljóðið úr Transport Tycoon Deluxe Windows útgáfunni.
|
||||
description.it_IT = Suoni originali di Transport Tycoon Deluxe, edizione Windows.
|
||||
description.ja_JP = Transport Tycoon Deluxe オリジナル版 効果音 (Windows)
|
||||
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도우 에디션의 효과음입니다.
|
||||
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 효과음입니다.
|
||||
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Sound.
|
||||
description.lt_LT = Originalūs Transport Tycoon Deluxe Windows leidimo garsai.
|
||||
description.nb_NO = Originale lyder fra Transport Tycoon Deluxe for Windows.
|
||||
|
617
changelog.txt
617
changelog.txt
File diff suppressed because it is too large
Load Diff
216
config.lib
216
config.lib
@@ -92,6 +92,7 @@ set_default() {
|
||||
with_ccache="1"
|
||||
with_nforenum="1"
|
||||
with_grfcodec="1"
|
||||
with_sse="1"
|
||||
|
||||
save_params_array="
|
||||
build
|
||||
@@ -166,6 +167,7 @@ set_default() {
|
||||
with_ccache
|
||||
with_grfcodec
|
||||
with_nforenum
|
||||
with_sse
|
||||
CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD"
|
||||
}
|
||||
|
||||
@@ -447,6 +449,10 @@ detect_params() {
|
||||
--with-threads) with_threads="1";;
|
||||
--with-threads=*) with_threads="$optarg";;
|
||||
|
||||
--without-sse) with_sse="0";;
|
||||
--with-sse) with_sse="1";;
|
||||
--with-sse=*) with_sse="$optarg";;
|
||||
|
||||
CC=* | --CC=*) CC="$optarg";;
|
||||
CXX=* | --CXX=*) CXX="$optarg";;
|
||||
CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
|
||||
@@ -587,6 +593,7 @@ check_params() {
|
||||
|
||||
check_makedepend
|
||||
detect_cputype
|
||||
detect_sse_capable_architecture
|
||||
|
||||
if [ "$enable_static" = "1" ]; then
|
||||
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
|
||||
@@ -1434,6 +1441,7 @@ make_cflags_and_ldflags() {
|
||||
make_compiler_cflags "$cc_host" "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
|
||||
|
||||
CFLAGS="$CFLAGS -D$os"
|
||||
CFLAGS_BUILD="$CFLAGS_BUILD -D$os"
|
||||
|
||||
if [ "$enable_debug" = "0" ]; then
|
||||
# No debug, add default stuff
|
||||
@@ -1443,7 +1451,11 @@ make_cflags_and_ldflags() {
|
||||
LDFLAGS="$LDFLAGS -noixemul"
|
||||
fi
|
||||
|
||||
CFLAGS="-O2 -fomit-frame-pointer $CFLAGS"
|
||||
if [ "$enable_profiling" = "0" ]; then
|
||||
# -fomit-frame-pointer and -pg do not go well together (gcc errors they are incompatible)
|
||||
CFLAGS="-fomit-frame-pointer $CFLAGS"
|
||||
fi
|
||||
CFLAGS="-O2 $CFLAGS"
|
||||
else
|
||||
OBJS_SUBDIR="debug"
|
||||
|
||||
@@ -1487,13 +1499,16 @@ make_cflags_and_ldflags() {
|
||||
fi
|
||||
|
||||
if [ "$enable_profiling" != "0" ]; then
|
||||
CFLAGS="$CFLAGS -p"
|
||||
CFLAGS="$CFLAGS -pg"
|
||||
LDFLAGS="$LDFLAGS -pg"
|
||||
fi
|
||||
|
||||
if [ "$with_threads" = "0" ]; then
|
||||
CFLAGS="$CFLAGS -DNO_THREADS"
|
||||
fi
|
||||
if [ "$with_sse" = "1" ]; then
|
||||
CFLAGS="$CFLAGS -DWITH_SSE"
|
||||
fi
|
||||
|
||||
if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
|
||||
if [ "$os" = "CYGWIN" ]; then
|
||||
@@ -1690,17 +1705,18 @@ make_cflags_and_ldflags() {
|
||||
|
||||
if [ -n "$png_config" ]; then
|
||||
CFLAGS="$CFLAGS -DWITH_PNG"
|
||||
CFLAGS="$CFLAGS `$png_config --cppflags --I_opts | tr '\n\r' ' '`"
|
||||
CFLAGS="$CFLAGS `$png_config --cflags | tr '\n\r' ' '`"
|
||||
|
||||
# The extra flags are unneeded for latest libpng-config, but some versions are so broken...
|
||||
if [ "$enable_static" != "0" ]; then
|
||||
if [ "$os" = "OSX" ]; then
|
||||
LIBS="$LIBS `$png_config --prefix`/lib/libpng.a"
|
||||
# fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix
|
||||
# Also, despite the reason we link to the .a file ourself (because we can't use -static), we do need to ask pkg-config about possible other deps
|
||||
LIBS="$LIBS `$png_config --variable=prefix`/lib/libpng.a `$png_config --libs --static | sed s@-lpng[0-9]*@@`"
|
||||
else
|
||||
LIBS="$LIBS `$png_config --static --ldflags | tr '\n\r' ' '`"
|
||||
LIBS="$LIBS `$png_config --libs --static | tr '\n\r' ' '`"
|
||||
fi
|
||||
else
|
||||
LIBS="$LIBS `$png_config --ldflags | tr '\n\r' ' '`"
|
||||
LIBS="$LIBS `$png_config --libs | tr '\n\r' ' '`"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -2705,80 +2721,64 @@ detect_libtimidity() {
|
||||
detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "" "timidity.h"
|
||||
}
|
||||
|
||||
detect_lzma() {
|
||||
# 0 means no, 1 is auto-detect, 2 is force
|
||||
if [ "$with_lzma" = "0" ]; then
|
||||
log 1 "checking liblzma... disabled"
|
||||
detect_pkg_config() {
|
||||
# $1 - config-param ($with_lzma value)
|
||||
# $2 - package name ('liblzma')
|
||||
# $3 - config name ('lzma_config', sets $lzma_config)
|
||||
# $4 - minimum module version ('2.3')
|
||||
|
||||
lzma_config=""
|
||||
# 0 means no, 1 is auto-detect, 2 is force
|
||||
if [ "$1" = "0" ]; then
|
||||
log 1 "checking $2... disabled"
|
||||
|
||||
eval "$3=\"\""
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$with_lzma" = "1" ] || [ "$with_lzma" = "" ] || [ "$with_lzma" = "2" ]; then
|
||||
lzma_config="pkg-config liblzma"
|
||||
log 2 "detecting $2"
|
||||
|
||||
if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
|
||||
pkg_config_call="pkg-config $2"
|
||||
else
|
||||
lzma_config="$with_lzma"
|
||||
pkg_config_call="$1"
|
||||
fi
|
||||
|
||||
version=`$lzma_config --modversion 2>/dev/null`
|
||||
version=`$pkg_config_call --modversion 2>/dev/null`
|
||||
ret=$?
|
||||
log 2 "executing $lzma_config --modversion"
|
||||
check_version "$4" "$version"
|
||||
version_ok=$?
|
||||
log 2 "executing $pkg_config_call --modversion"
|
||||
log 2 " returned $version"
|
||||
log 2 " exit code $ret"
|
||||
|
||||
if [ -z "$version" ] || [ "$ret" != "0" ]; then
|
||||
log 1 "checking liblzma... not found"
|
||||
if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
|
||||
if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
|
||||
log 1 "checking $2... needs at least version $4, $2 NOT enabled"
|
||||
else
|
||||
log 1 "checking $2... not found"
|
||||
fi
|
||||
|
||||
# It was forced, so it should be found.
|
||||
if [ "$with_lzma" != "1" ]; then
|
||||
log 1 "configure: error: pkg-config liblzma couldn't be found"
|
||||
log 1 "configure: error: you supplied '$with_lzma', but it seems invalid"
|
||||
if [ "$1" != "1" ]; then
|
||||
log 1 "configure: error: pkg-config $2 couldn't be found"
|
||||
log 1 "configure: error: you supplied '$1', but it seems invalid"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
lzma_config=""
|
||||
eval "$3=\"\""
|
||||
return 0
|
||||
fi
|
||||
|
||||
log 1 "checking liblzma... found"
|
||||
eval "$3=\"$pkg_config_call\""
|
||||
log 1 "checking $2... found"
|
||||
}
|
||||
|
||||
detect_lzma() {
|
||||
detect_pkg_config "$with_lzma" "liblzma" "lzma_config" "5.0"
|
||||
}
|
||||
|
||||
detect_xdg_basedir() {
|
||||
# 0 means no, 1 is auto-detect, 2 is force
|
||||
if [ "$with_xdg_basedir" = "0" ]; then
|
||||
log 1 "checking libxdg_basedir... disabled"
|
||||
|
||||
xdg_basedir_config=""
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$with_xdg_basedir" = "1" ] || [ "$with_xdg_basedir" = "" ] || [ "$with_xdg_basedir" = "2" ]; then
|
||||
xdg_basedir_config="pkg-config libxdg-basedir"
|
||||
else
|
||||
xdg_basedir_config="$with_xdg_basedir"
|
||||
fi
|
||||
|
||||
version=`$xdg_basedir_config --modversion 2>/dev/null`
|
||||
ret=$?
|
||||
log 2 "executing $xdg_basedir_config --modversion"
|
||||
log 2 " returned $version"
|
||||
log 2 " exit code $ret"
|
||||
|
||||
if [ -z "$version" ] || [ "$ret" != "0" ]; then
|
||||
log 1 "checking libxdg_basedir... not found"
|
||||
|
||||
# It was forced, so it should be found.
|
||||
if [ "$with_xdg_basedir" != "1" ]; then
|
||||
log 1 "configure: error: pkg-config libxdg_basedir couldn't be found"
|
||||
log 1 "configure: error: you supplied '$with_xdg_basedir', but it seems invalid"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
xdg_basedir_config=""
|
||||
return 0
|
||||
fi
|
||||
|
||||
log 1 "checking libxdg_basedir... found"
|
||||
detect_pkg_config "$with_xdg_basedir" "libxdg-basedir" "xdg_basedir_config" "1.2"
|
||||
}
|
||||
|
||||
detect_png() {
|
||||
@@ -2805,33 +2805,7 @@ detect_png() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$with_png" = "1" ] || [ "$with_png" = "" ] || [ "$with_png" = "2" ]; then
|
||||
png_config="libpng-config"
|
||||
else
|
||||
png_config="$with_png"
|
||||
fi
|
||||
|
||||
version=`$png_config --version 2>/dev/null`
|
||||
ret=$?
|
||||
log 2 "executing $png_config --version"
|
||||
log 2 " returned $version"
|
||||
log 2 " exit code $ret"
|
||||
|
||||
if [ -z "$version" ] || [ "$ret" != "0" ]; then
|
||||
log 1 "checking libpng... not found"
|
||||
|
||||
# It was forced, so it should be found.
|
||||
if [ "$with_png" != "1" ]; then
|
||||
log 1 "configure: error: libpng-config couldn't be found"
|
||||
log 1 "configure: error: you supplied '$with_png', but it seems invalid"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
png_config=""
|
||||
return 0
|
||||
fi
|
||||
|
||||
log 1 "checking libpng... found"
|
||||
detect_pkg_config "$with_png" "libpng" "png_config" "1.2"
|
||||
}
|
||||
|
||||
detect_freetype() {
|
||||
@@ -2926,39 +2900,7 @@ detect_fontconfig() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$with_fontconfig" = "1" ] || [ "$with_fontconfig" = "" ] || [ "$with_fontconfig" = "2" ]; then
|
||||
fontconfig_config="pkg-config fontconfig"
|
||||
else
|
||||
fontconfig_config="$with_fontconfig"
|
||||
fi
|
||||
|
||||
version=`$fontconfig_config --modversion 2>/dev/null`
|
||||
ret=$?
|
||||
check_version '2.3' "$version"
|
||||
version_ok=$?
|
||||
log 2 "executing $fontconfig_config --modversion"
|
||||
log 2 " returned $version"
|
||||
log 2 " exit code $ret"
|
||||
|
||||
if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
|
||||
if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
|
||||
log 1 "checking libfontconfig... needs at least version 2.3.0, fontconfig NOT enabled"
|
||||
else
|
||||
log 1 "checking libfontconfig... not found"
|
||||
fi
|
||||
|
||||
# It was forced, so it should be found.
|
||||
if [ "$with_fontconfig" != "1" ]; then
|
||||
log 1 "configure: error: fontconfig-config couldn't be found"
|
||||
log 1 "configure: error: you supplied '$with_fontconfig', but it seems invalid"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fontconfig_config=""
|
||||
return 0
|
||||
fi
|
||||
|
||||
log 1 "checking libfontconfig... found"
|
||||
detect_pkg_config "$with_fontconfig" "fontconfig" "fontconfig_config" "2.3"
|
||||
}
|
||||
|
||||
detect_icu() {
|
||||
@@ -3324,6 +3266,40 @@ detect_cputype() {
|
||||
rm -f tmp.64bit tmp.64bit.cpp
|
||||
}
|
||||
|
||||
detect_sse_capable_architecture() {
|
||||
# 0 means no, 1 is auto-detect, 2 is force
|
||||
if [ "$with_sse" = "0" ]; then
|
||||
log 1 "checking SSE... disabled"
|
||||
return
|
||||
fi
|
||||
|
||||
echo "#define _SQ64 1" > tmp.sse.cpp
|
||||
echo "#include <xmmintrin.h>" >> tmp.sse.cpp
|
||||
echo "#include <smmintrin.h>" >> tmp.sse.cpp
|
||||
echo "#include <tmmintrin.h>" >> tmp.sse.cpp
|
||||
echo "int main() { return 0; }" >> tmp.sse.cpp
|
||||
execute="$cxx_host -msse4.1 $CFLAGS tmp.sse.cpp -o tmp.sse 2>&1"
|
||||
sse="`eval $execute 2>/dev/null`"
|
||||
ret=$?
|
||||
log 2 "executing $execute"
|
||||
log 2 " returned $sse"
|
||||
log 2 " exit code $ret"
|
||||
if [ "$ret" = "0" ]; then
|
||||
log 1 "detecting SSE... found"
|
||||
else
|
||||
# It was forced, so it should be found.
|
||||
if [ "$with_sse" != "1" ]; then
|
||||
log 1 "configure: error: SSE couln't be found"
|
||||
log 1 "configure: error: you force enabled SSE, but it seems unavailable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log 1 "detecting SSE... not found"
|
||||
with_sse="0"
|
||||
fi
|
||||
rm -f tmp.sse tmp.exe tmp.sse.cpp
|
||||
}
|
||||
|
||||
make_sed() {
|
||||
T_CFLAGS="$CFLAGS"
|
||||
T_CXXFLAGS="$CXXFLAGS"
|
||||
@@ -3714,6 +3690,8 @@ showhelp() {
|
||||
echo " --with-ccache enables ccache support"
|
||||
echo " --with-distcc enables distcc support"
|
||||
echo " --without-grfcodec disable usage of grfcodec and re-generation of base sets"
|
||||
echo " --without-threads disable threading support"
|
||||
echo " --without-sse disable SSE support (x86/x86_64 only)"
|
||||
echo ""
|
||||
echo "Some influential environment variables:"
|
||||
echo " CC C compiler command"
|
||||
|
1
configure
vendored
1
configure
vendored
@@ -129,6 +129,7 @@ AWKCOMMAND='
|
||||
if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" == "0") { next; }
|
||||
if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; }
|
||||
if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0") { next; }
|
||||
if ($0 == "SSE" && "'$with_sse'" != "1") { next; }
|
||||
|
||||
skip += 1;
|
||||
|
||||
|
262
docs/desync.txt
Normal file
262
docs/desync.txt
Normal file
@@ -0,0 +1,262 @@
|
||||
Some explanations about Desyncs
|
||||
Last updated: 2014-02-23
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
Table of contents
|
||||
-----------------
|
||||
1.0) Desync theory
|
||||
* 1.1) OpenTTD multiplayer architecture
|
||||
* 1.2) What is a Desync and how is it detected
|
||||
* 1.3) Typical causes of Desyncs
|
||||
2.0) What to do in case of a Desync
|
||||
* 2.1) Cache debugging
|
||||
* 2.2) Desync recording
|
||||
3.0) Evaluating the Desync records
|
||||
* 3.1) Replaying
|
||||
* 3.2) Evaluation the replay
|
||||
* 3.3) Comparing savegames
|
||||
|
||||
|
||||
1.1) OpenTTD multiplayer architecture
|
||||
---- --------------------------------
|
||||
OpenTTD has a huge gamestate, which changes all of the time.
|
||||
The savegame contains the complete gamestate at a specific point
|
||||
in time. But this state changes completely each tick: Vehicles move
|
||||
and trees grow.
|
||||
|
||||
However, most of these changes in the gamestate are deterministic:
|
||||
Without a player interfering a vehicle follows its orders always
|
||||
in the same way, and trees always grow the same.
|
||||
|
||||
In OpenTTD multiplayer synchronisation works by creating a savegame
|
||||
when clients join, and then transfering that savegame to the client,
|
||||
so it has the complete gamestate at a fixed point in time.
|
||||
|
||||
Afterwards clients only receive 'commands', that is: Stuff which is
|
||||
not predictable, like
|
||||
- player actions
|
||||
- AI actions
|
||||
- GameScript actions
|
||||
- Admin Port command
|
||||
- rcon commands
|
||||
- ...
|
||||
|
||||
These commands contain the information on how to execute the command,
|
||||
and when to execute it. Time is measured in 'network frames'.
|
||||
Mind that network frames to not match ingame time. Network frames
|
||||
also run while the game is paused, to give a defined behaviour to
|
||||
stuff that is executing while the game is paused.
|
||||
|
||||
The deterministic part of the gamestate is run by the clients on
|
||||
their own. All they get from the server is the instruction to
|
||||
run the gamestate up to a certain network time, which basically
|
||||
says that there are no commands scheduled in that time.
|
||||
|
||||
When a client (which includes the server itself) wants to execute
|
||||
a command (i.e. a non-predictable action), it does this by
|
||||
- calling DoCommandP resp. DoCommandPInternal
|
||||
- These functions first do a local test-run of the command to
|
||||
check simple preconditions. (Just to give the client an
|
||||
immediate response without bothering the server and waiting for
|
||||
the response.) The test-run may not actually change the
|
||||
gamestate, all changes must be discarded.
|
||||
- If the local test-run succeeds the command is sent to the server.
|
||||
- The server inserts the command into the command queue, which
|
||||
assigns a network frame to the commands, i.e. when it shall be
|
||||
executed on all clients.
|
||||
- Enhanced with this specific timestamp, the command is send to all
|
||||
clients, which execute the command simultaneously in the same
|
||||
network frame in the same order.
|
||||
|
||||
1.2) What is a Desync and how is it detected
|
||||
---- ---------------------------------------
|
||||
In the ideal case all clients have the same gamestate as the server
|
||||
and run in sync. That is, vehicle movement is the same on all
|
||||
clients, and commands are executed the same everywhere and
|
||||
have the same results.
|
||||
|
||||
When a Desync happens, it means that the gamestates on the clients
|
||||
(including the server) are no longer the same. Just imagine
|
||||
that a vehicle picks the left line instead of the right line at
|
||||
a junction on one client.
|
||||
|
||||
The important thing here is, that noone notices when a Desync
|
||||
occurs. The desync client will continue to simulate the gamestate
|
||||
and execute commands from the server. Once the gamestate differs
|
||||
it will increasingly spiral out of control: If a vehicle picks a
|
||||
different route, it will arrive at a different time at a station,
|
||||
which will load different cargo, which causes other vehicles to
|
||||
load other stuff, which causes industries to notice different
|
||||
servicing, which causes industries to change production, ...
|
||||
the client could run all day in a different universe.
|
||||
|
||||
To limit how long a Desync can remain unnoticed, the server
|
||||
transfers some checksums every now and then for the gamestate.
|
||||
Currently this checksum is the state of the random number
|
||||
generator of the game logic. A lot of things in OpenTTD depend
|
||||
on the RNG, and if the gamestate differs, it is likely that the
|
||||
RNG is called at different times, and the state differs when
|
||||
checked.
|
||||
|
||||
The clients compare this 'checksum' with the checksum of their
|
||||
own gamestate at the specific network frame. If they differ,
|
||||
the client disconnects with a Desync error.
|
||||
|
||||
The important thing here is: The detection of the Desync is
|
||||
only an ultimate failure detection. It does not give any
|
||||
indication on when the Desync happened. The Desync may after
|
||||
all have occured long ago, and just did not affect the checksum
|
||||
up to now. The checksum may have matched 10 times or more
|
||||
since the Desync happend, and only now the Desync has spiraled
|
||||
enough to finally affect the checksum. (There was once a desync
|
||||
which was only noticed by the checksum after 20 game years.)
|
||||
|
||||
1.3) Typical causes of Desyncs
|
||||
---- -------------------------
|
||||
Desyncs can be caused by the following scenarios:
|
||||
- The savegame does not describe the complete gamestate.
|
||||
- Some information which affects the progression of the
|
||||
gamestate is not saved in the savegame.
|
||||
- Some information which affects the progression of the
|
||||
gamestate is not loaded from the savegame.
|
||||
This includes the case that something is not completely
|
||||
reset before loading the savegame, so data from the
|
||||
previous game is carried over to the new one.
|
||||
- The gamestate does not behave deterministic.
|
||||
- Cache mismatch: The game logic depends on some cached
|
||||
values, which are not invalidated properly. This is
|
||||
the usual case for NewGRF-specific Desyncs.
|
||||
- Undefined behaviour: The game logic performs multiple
|
||||
things in an undefined order or with an undefined
|
||||
result. E.g. when sorting something with a key while
|
||||
some keys are equal. Or some computation that depends
|
||||
on the CPU architecture (32/64 bit, little/big endian).
|
||||
- The gamestate is modified when it shall not be modified.
|
||||
- The test-run of a command alters the gamestate.
|
||||
- The gamestate is altered by a player or script without
|
||||
using commands.
|
||||
|
||||
|
||||
2.1) Cache debugging
|
||||
---- ---------------
|
||||
Desyncs which are caused by inproper cache validation can
|
||||
often be found by enabling cache validation:
|
||||
- Start OpenTTD with '-d desync=2'.
|
||||
- This will enable validation of caches every tick.
|
||||
That is, cached values are recomputed every tick and compared
|
||||
to the cached value.
|
||||
- Differences are logged to 'commands-out.log' in the autosave
|
||||
folder.
|
||||
|
||||
Mind that this type of debugging can also be done in singleplayer.
|
||||
|
||||
2.2) Desync recording
|
||||
---- ----------------
|
||||
If you have a server, which happens to encounter Desyncs often,
|
||||
you can enable recording of the gamestate alterations. This
|
||||
will later allow the replay the gamestate and locate the Desync
|
||||
cause.
|
||||
|
||||
There are two levels of Desync recording, which are enabled
|
||||
via '-d desync=2' resp. '-d desync=3'. Both will record all
|
||||
commands to a file 'commands-out.log' in the autosave folder.
|
||||
|
||||
If you have the savegame from the start of the server, and
|
||||
this command log you can replay the whole game. (see Section 3.1)
|
||||
|
||||
If you do not start the server from a savegame, there will
|
||||
also be a savegame created just after a map has been generated.
|
||||
The savegame will be named 'dmp_cmds_*.sav' and be put into
|
||||
the autosave folder.
|
||||
|
||||
In addition to that '-d desync=3' also creates regular savegames
|
||||
at defined spots in network time. (more defined than regular
|
||||
autosaves). These will be created in the autosave folder
|
||||
and will also be named 'dmp_cmds_*.sav'.
|
||||
|
||||
These saves allow comparing the gamestate with the original
|
||||
gamestate during replaying, and thus greatly help debugging.
|
||||
However, they also take a lot of disk space.
|
||||
|
||||
|
||||
3.1) Replaying
|
||||
---- ---------
|
||||
To replay a Desync recording, you need these files:
|
||||
- The savegame from when the server was started, resp.
|
||||
the automatically created savegame from when the map
|
||||
was generated.
|
||||
- The 'commands-out.log' file.
|
||||
- Optionally the 'dmp_cmds_*.sav'.
|
||||
Put these files into a safe spot. (Not your autosave folder!)
|
||||
|
||||
Next, prepare your OpenTTD for replaying:
|
||||
- Get the same version of OpenTTD as the original server was running.
|
||||
- Uncomment/enable the define 'DEBUG_DUMP_COMMANDS' in
|
||||
'src/network/network_func.h'.
|
||||
- Put the 'commands-out.log' into the root save folder, and rename
|
||||
it to 'commands.log'.
|
||||
- Run 'openttd -D -d desync=3 -g startsavegame.sav'.
|
||||
This replays the server log and creates new 'commands-out.log'
|
||||
and 'dmp_cmds_*.sav' in your autosave folder.
|
||||
|
||||
3.2) Evaluation the replay
|
||||
---- ---------------------
|
||||
The replaying will also compare the checksums which are part of
|
||||
the 'commands-out.log' with the replayed gamestate.
|
||||
If they differ, it will trigger a 'NOT_REACHED'.
|
||||
|
||||
If the replay succeeds without mismatch, that is the replay reproduces
|
||||
the original server state:
|
||||
- Repeat the replay starting from incrementally later 'dmp_cmds_*.sav'
|
||||
while truncating the 'commands.log' at the beginning appropriately.
|
||||
The 'dmp_cmds_*.sav' can be your own ones from the first reply, or
|
||||
the ones from the original server (if you have them).
|
||||
(This simulates the view of joining clients during the game.)
|
||||
- If one of those replays fails, you have located the Desync between
|
||||
the last dmp_cmds that reproduces the replay and the first one
|
||||
that fails.
|
||||
|
||||
If you have the original 'dmp_cmds_*.sav', you can also compare those
|
||||
savegames with your own ones from the replay. You can also comment/disable
|
||||
the 'NOT_REACHED' mentioned above, to get another 'dmp_cmds_*.sav' from
|
||||
the replay after the mismatch has already been detected.
|
||||
See Section 3.2 on how to compare savegames.
|
||||
If the saves differ you have located the Desync between the last dmp_cmds
|
||||
that match and the first one that does not. The difference of the saves
|
||||
may point you in the direction of what causes it.
|
||||
|
||||
If the replay succeeds without mismatch, and you do not have any
|
||||
'dmp_cmd_*.sav' from the original server, it is a lost case.
|
||||
Enable creation of the 'dmp_cmd_*.sav' on the server, and wait for the
|
||||
next Desync.
|
||||
|
||||
Finally, you can also compare the 'commands-out.log' from the original
|
||||
server with the one from the replay. They will differ in stuff like
|
||||
dates, and the original log will contain the chat, but otherwise they
|
||||
should match.
|
||||
|
||||
3.2) Comparing savegames
|
||||
---- -------------------
|
||||
The binary form of the savegames from the original server and from
|
||||
your replay will always differ:
|
||||
- The savegame contains paths to used NewGRF files.
|
||||
- The gamelog will log your loading of the savegame.
|
||||
- The savegame data of AIs and the Gamescript will differ.
|
||||
Scripts are not run during the replay, only their recorded commands
|
||||
are replayed. Their internal state will thus not change in the
|
||||
replay and will differ.
|
||||
|
||||
To compare savegame more semantically, there exist some ugly hackish
|
||||
tools at:
|
||||
http://devs.openttd.org/~frosch/texts/zpipe.c
|
||||
http://devs.openttd.org/~frosch/texts/printhunk.c
|
||||
|
||||
The first one decompresses OpenTTD savegames. The second one creates
|
||||
a textual representation of an uncompressed savegame, by parsing hunks
|
||||
and arrays and such. With both tools you need to be a bit careful
|
||||
since they work on stdin and stdout, which may not deal well with
|
||||
binary data.
|
||||
|
||||
If you have the textual representation of the savegames, you can
|
||||
compare them with regular diff tools.
|
@@ -539,6 +539,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
<li>m3 bits 7..4: <a href="#OwnershipInfo">owner</a> of road type 1 (tram); OWNER_NONE (<tt>10</tt>) is stored as OWNER_TOWN (<tt>0F</tt>)
|
||||
<li>m5 bits 7 clear: road or level-crossing
|
||||
<ul>
|
||||
<li>m6 bits 5..3:
|
||||
@@ -573,7 +574,6 @@
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
<li>m3 bits 7..4: <a href="#OwnershipInfo">owner</a> of road type 1 (tram); OWNER_NONE (<tt>10</tt>) is stored as OWNER_TOWN (<tt>0F</tt>)
|
||||
<li>m5 bit 6 clear: road
|
||||
<ul>
|
||||
<li>m1 bits 4..0: <a href="#OwnershipInfo">owner</a> of the road type 0 (normal road)</li>
|
||||
@@ -663,6 +663,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
</li>
|
||||
<li>m7 bits 4..0: <a href="#OwnershipInfo">owner</a> of the road type 0 (normal road)</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>m6 bits 7..6 : Possibility of a bridge above, in the <a href="#bridge_direction">direction specified</a></li>
|
||||
|
@@ -147,11 +147,11 @@ the array so you can quickly see what is used and what is not.
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits">-inherit-</td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XXXX <span class="free">OOOO</span></td>
|
||||
<td class="bits"><span class="free">OOOO OOOO</span></td>
|
||||
<td class="bits">XX<span class="free">OO OO</span>XX</td>
|
||||
<td class="bits">XX<span class="free">OO OO</span>XX</td>
|
||||
<td class="bits">XXX<span class="free">O OOOO</span></td>
|
||||
<td class="bits">XXX<span class="free">O</span> XXXX</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>3</td>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
OpenTTD's known bugs
|
||||
Last updated: 2013-12-24
|
||||
Release version: 1.4.0-beta1
|
||||
Last updated: 2014-10-08
|
||||
Release version: 1.4.4-RC1
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -33,12 +33,13 @@ No suitable AI can be found
|
||||
If you have no AIs and an AI is started the so-called 'dummy' AI will
|
||||
be loaded. This AI does nothing but writing a message on the AI debug
|
||||
window and showing a red warning. There are basically two solutions
|
||||
for this problem: you must change the settings so no AI is started,
|
||||
this is done in the difficulty settings window. The other solution is
|
||||
acquiring (downloading) some AI. The easiest way to do this is via
|
||||
the "Check Online Content" button in the main (intro) menu or via
|
||||
"AI Settings" -> "Select AI" -> "Check Online Content" which is also
|
||||
accessed via the main menu.
|
||||
for this problem: Either you set the number of AI players to 0 so that
|
||||
no AI is started. You find that setting at the top of the window in the
|
||||
"AI / Game Scripts Settings" window.
|
||||
The other solution is acquiring (downloading) some AI. The easiest way
|
||||
to do this is via the "Check Online Content" button in the main (intro)
|
||||
menu or directly in the "AI / Game Scripts Settings" dialogue via the
|
||||
"Check Online Content" button.
|
||||
|
||||
After a while of playing, colours get corrupted
|
||||
In Windows 7 the background slideshow corrupts the colour mapping of
|
||||
@@ -444,3 +445,11 @@ Trains might not stop at platforms that are currently being changed [FS#5553]:
|
||||
just anywhere in the station because then it would never leave the station
|
||||
if you have the same station in the order list multiple times in a row or
|
||||
if there is only one station in the order list (see FS#5684).
|
||||
|
||||
Some houses and industries are not affected by transparency [FS#5817]:
|
||||
Some of the default houses and industries (f.e. the iron ore mine) are
|
||||
not affected by the transparency options. This is because the graphics do
|
||||
not (completely) separate the ground from the building.
|
||||
This is a bug of the original graphics, and unfortunately cannot be
|
||||
fixed with OpenGFX for the sake of maintaining compatibility with the
|
||||
original graphics.
|
||||
|
32
media/extra_grf/assemble_nfo.awk
Normal file
32
media/extra_grf/assemble_nfo.awk
Normal file
@@ -0,0 +1,32 @@
|
||||
# $Id$
|
||||
|
||||
# This file is part of OpenTTD.
|
||||
# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
BEGIN {
|
||||
# Very basic variant function; barely any error checking.
|
||||
# Just use the first argument as the file to start from when assembling everything
|
||||
path = ARGV[1];
|
||||
gsub("[^/\\\\]*$", "", path);
|
||||
assemble(ARGV[1]);
|
||||
}
|
||||
|
||||
# Recursive function for assembling by means of resolving the #includes.
|
||||
function assemble(filename) {
|
||||
while ((getline < filename) > 0) {
|
||||
if (NF == 2 && $1 == "#include" ) {
|
||||
# Remove the quotes.
|
||||
gsub("[\"'<>]", "", $2);
|
||||
assemble(path $2);
|
||||
} else {
|
||||
print $0;
|
||||
}
|
||||
}
|
||||
|
||||
if (close(filename) < 0) {
|
||||
print "Could not open " filename > "/dev/stderr";
|
||||
exit -1;
|
||||
}
|
||||
}
|
@@ -1,8 +1,104 @@
|
||||
openttd (1.4.0~beta1) unstable; urgency=low
|
||||
openttd (1.4.4~RC1-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.4-RC1
|
||||
|
||||
-- OpenTTD <info@openttd.org> Wed, 08 Oct 2014 19:00:00 +0200
|
||||
|
||||
openttd (1.4.3-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.3
|
||||
|
||||
-- OpenTTD <info@openttd.org> Tue, 23 Sep 2014 21:00:00 +0200
|
||||
|
||||
openttd (1.4.3~RC2-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.3-RC2
|
||||
|
||||
-- OpenTTD <info@openttd.org> Sun, 14 Sep 2014 19:00:00 +0200
|
||||
|
||||
openttd (1.4.3~RC1-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.3-RC1
|
||||
|
||||
-- OpenTTD <info@openttd.org> Sun, 07 Sep 2014 19:00:00 +0200
|
||||
|
||||
openttd (1.4.2-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.2
|
||||
|
||||
-- OpenTTD <info@openttd.org> Sat, 16 Aug 2014 21:00:00 +0200
|
||||
|
||||
openttd (1.4.2~RC2-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.2-RC2
|
||||
|
||||
-- OpenTTD <info@openttd.org> Sun, 03 Aug 2014 18:00:00 +0200
|
||||
|
||||
openttd (1.4.2~RC1-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.2-RC1
|
||||
|
||||
-- OpenTTD <info@openttd.org> Thu, 03 Jul 2014 21:00:00 +0200
|
||||
|
||||
openttd (1.4.1-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.1
|
||||
|
||||
-- OpenTTD <info@openttd.org> Mon, 02 Jun 2014 21:00:00 +0200
|
||||
|
||||
openttd (1.4.1~RC2-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.1-RC2
|
||||
|
||||
-- OpenTTD <info@openttd.org> Sun, 18 May 2014 21:00:00 +0200
|
||||
|
||||
openttd (1.4.1~RC1-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.1-RC1
|
||||
|
||||
-- OpenTTD <info@openttd.org> Sun, 04 May 2014 21:00:00 +0200
|
||||
|
||||
openttd (1.4.0-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.0
|
||||
|
||||
-- OpenTTD <info@openttd.org> Tue, 01 Apr 2014 21:00:00 +0200
|
||||
|
||||
openttd (1.4.0~RC1-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.0-RC1
|
||||
|
||||
-- OpenTTD <info@openttd.org> Tue, 17 Mar 2014 21:00:00 +0100
|
||||
|
||||
openttd (1.4.0~beta5-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.0-beta5
|
||||
|
||||
-- OpenTTD <info@openttd.org> Tue, 25 Feb 2014 10:15:00 +0100
|
||||
|
||||
openttd (1.4.0~beta4-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.0-beta4
|
||||
|
||||
-- OpenTTD <info@openttd.org> Thu, 06 Feb 2014 21:00:00 +0100
|
||||
|
||||
openttd (1.4.0~beta3-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.0-beta3
|
||||
|
||||
-- OpenTTD <info@openttd.org> Tue, 21 Jan 2014 21:00:00 +0100
|
||||
|
||||
openttd (1.4.0~beta2-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.0-beta2
|
||||
|
||||
-- OpenTTD <info@openttd.org> Tue, 07 Jan 2014 21:00:00 +0100
|
||||
|
||||
openttd (1.4.0~beta1-0) unstable; urgency=low
|
||||
|
||||
* New upstream release 1.4.0-beta1
|
||||
|
||||
-- OpenTTD <info@openttd.org> Tue, 24 Dec 2012 00:00:00 +0100
|
||||
-- OpenTTD <info@openttd.org> Tue, 24 Dec 2013 00:00:00 +0100
|
||||
|
||||
openttd (1.3.3-0) unstable; urgency=low
|
||||
|
||||
|
@@ -3,7 +3,7 @@ Section: games
|
||||
Priority: optional
|
||||
Maintainer: Matthijs Kooijman <matthijs@stdin.nl>
|
||||
Uploaders: Jordi Mallach <jordi@debian.org>
|
||||
Build-Depends: debhelper (>= 7.0.50), libsdl-dev, zlib1g-dev, libpng-dev, libfreetype6-dev, libfontconfig-dev, libicu-dev, liblzma-dev, liblzo2-dev, libxdg-basedir-dev
|
||||
Build-Depends: debhelper (>= 7.0.50), libsdl-dev, zlib1g-dev, libpng-dev, libfreetype6-dev, libfontconfig-dev, libicu-dev, liblzma-dev, liblzo2-dev
|
||||
Standards-Version: 3.8.4
|
||||
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/openttd.git
|
||||
Vcs-Git: git://anonscm.debian.org/collab-maint/openttd.git
|
||||
|
@@ -29,7 +29,7 @@ include /usr/share/dpkg/buildflags.mk
|
||||
# to be explicit about the dependencies, in case we're not running in a
|
||||
# clean build root.
|
||||
override_dh_auto_configure:
|
||||
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu --with-liblzo2 --with-lzma --with-xdg-basedir --without-iconv --disable-strip CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS_BUILD="$(LDFLAGS)"
|
||||
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu --with-liblzo2 --with-lzma --without-xdg-basedir --without-iconv --disable-strip CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS_BUILD="$(LDFLAGS)"
|
||||
|
||||
# Do some extra installation
|
||||
override_dh_auto_install:
|
||||
|
@@ -1,9 +1,9 @@
|
||||
# Version numbers to update
|
||||
!define APPV_MAJOR 1
|
||||
!define APPV_MINOR 4
|
||||
!define APPV_MAINT 0
|
||||
!define APPV_MAINT 4
|
||||
!define APPV_BUILD 0
|
||||
!define APPV_EXTRA "-beta1"
|
||||
!define APPV_EXTRA "-RC1"
|
||||
|
||||
!define APPNAME "OpenTTD" ; Define application name
|
||||
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version
|
||||
|
@@ -173,6 +173,7 @@ Function load_main_data(filename, ByRef vcxproj, ByRef filters, ByRef files)
|
||||
line = "MSVC" Or _
|
||||
line = "DIRECTMUSIC" Or _
|
||||
line = "AI" Or _
|
||||
line = "SSE" Or _
|
||||
line = "HAVE_THREAD" _
|
||||
) Then skip = skip + 1
|
||||
deep = deep + 1
|
||||
|
@@ -102,7 +102,7 @@
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
@@ -156,7 +156,7 @@
|
||||
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@@ -204,7 +204,7 @@
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
@@ -256,7 +256,7 @@
|
||||
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@@ -304,6 +304,7 @@
|
||||
<ClCompile Include="..\src\command.cpp" />
|
||||
<ClCompile Include="..\src\console.cpp" />
|
||||
<ClCompile Include="..\src\console_cmds.cpp" />
|
||||
<ClCompile Include="..\src\cpu.cpp" />
|
||||
<ClCompile Include="..\src\crashlog.cpp" />
|
||||
<ClCompile Include="..\src\currency.cpp" />
|
||||
<ClCompile Include="..\src\date.cpp" />
|
||||
@@ -354,7 +355,6 @@
|
||||
<ClCompile Include="..\src\network\network_udp.cpp" />
|
||||
<ClCompile Include="..\src\openttd.cpp" />
|
||||
<ClCompile Include="..\src\order_backup.cpp" />
|
||||
<ClCompile Include="..\src\os_timer.cpp" />
|
||||
<ClCompile Include="..\src\pbs.cpp" />
|
||||
<ClCompile Include="..\src\progress.cpp" />
|
||||
<ClCompile Include="..\src\rail.cpp" />
|
||||
@@ -385,6 +385,7 @@
|
||||
<ClCompile Include="..\src\vehicle.cpp" />
|
||||
<ClCompile Include="..\src\vehiclelist.cpp" />
|
||||
<ClCompile Include="..\src\viewport.cpp" />
|
||||
<ClCompile Include="..\src\viewport_sprite_sorter_sse4.cpp" />
|
||||
<ClCompile Include="..\src\waypoint.cpp" />
|
||||
<ClCompile Include="..\src\widget.cpp" />
|
||||
<ClCompile Include="..\src\window.cpp" />
|
||||
@@ -422,6 +423,7 @@
|
||||
<ClInclude Include="..\src\console_gui.h" />
|
||||
<ClInclude Include="..\src\console_internal.h" />
|
||||
<ClInclude Include="..\src\console_type.h" />
|
||||
<ClInclude Include="..\src\cpu.h" />
|
||||
<ClInclude Include="..\src\crashlog.h" />
|
||||
<ClInclude Include="..\src\currency.h" />
|
||||
<ClInclude Include="..\src\date_func.h" />
|
||||
@@ -640,6 +642,7 @@
|
||||
<ClInclude Include="..\src\vehicle_type.h" />
|
||||
<ClInclude Include="..\src\vehiclelist.h" />
|
||||
<ClInclude Include="..\src\viewport_func.h" />
|
||||
<ClInclude Include="..\src\viewport_sprite_sorter.h" />
|
||||
<ClInclude Include="..\src\viewport_type.h" />
|
||||
<ClInclude Include="..\src\water.h" />
|
||||
<ClInclude Include="..\src\waypoint_base.h" />
|
||||
@@ -947,13 +950,7 @@
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\squirrel\sqpcheader.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\squirrel\sqstate.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdaux.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdblob.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\sqstdlib\sqstdblobimpl.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdio.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdmath.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\sqstdlib\sqstdstream.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdstring.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdsystem.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\squirrel\sqstring.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\squirrel\sqtable.h" />
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\squirrel.h" />
|
||||
@@ -1033,6 +1030,8 @@
|
||||
<ClInclude Include="..\src\script\api\script_station.hpp" />
|
||||
<ClInclude Include="..\src\script\api\script_stationlist.hpp" />
|
||||
<ClInclude Include="..\src\script\api\script_story_page.hpp" />
|
||||
<ClInclude Include="..\src\script\api\script_storypagelist.hpp" />
|
||||
<ClInclude Include="..\src\script\api\script_storypageelementlist.hpp" />
|
||||
<ClInclude Include="..\src\script\api\script_subsidy.hpp" />
|
||||
<ClInclude Include="..\src\script\api\script_subsidylist.hpp" />
|
||||
<ClInclude Include="..\src\script\api\script_testmode.hpp" />
|
||||
@@ -1095,6 +1094,8 @@
|
||||
<ClCompile Include="..\src\script\api\script_station.cpp" />
|
||||
<ClCompile Include="..\src\script\api\script_stationlist.cpp" />
|
||||
<ClCompile Include="..\src\script\api\script_story_page.cpp" />
|
||||
<ClCompile Include="..\src\script\api\script_storypagelist.cpp" />
|
||||
<ClCompile Include="..\src\script\api\script_storypageelementlist.cpp" />
|
||||
<ClCompile Include="..\src\script\api\script_subsidy.cpp" />
|
||||
<ClCompile Include="..\src\script\api\script_subsidylist.cpp" />
|
||||
<ClCompile Include="..\src\script\api\script_testmode.cpp" />
|
||||
@@ -1112,12 +1113,22 @@
|
||||
<ClCompile Include="..\src\script\api\script_window.cpp" />
|
||||
<ClCompile Include="..\src\blitter\32bpp_anim.cpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_anim.hpp" />
|
||||
<ClCompile Include="..\src\blitter\32bpp_anim_sse4.cpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_anim_sse4.hpp" />
|
||||
<ClCompile Include="..\src\blitter\32bpp_base.cpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_base.hpp" />
|
||||
<ClCompile Include="..\src\blitter\32bpp_optimized.cpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_optimized.hpp" />
|
||||
<ClCompile Include="..\src\blitter\32bpp_simple.cpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_simple.hpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_sse_func.hpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_sse_type.h" />
|
||||
<ClCompile Include="..\src\blitter\32bpp_sse2.cpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_sse2.hpp" />
|
||||
<ClCompile Include="..\src\blitter\32bpp_sse4.cpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_sse4.hpp" />
|
||||
<ClCompile Include="..\src\blitter\32bpp_ssse3.cpp" />
|
||||
<ClInclude Include="..\src\blitter\32bpp_ssse3.hpp" />
|
||||
<ClCompile Include="..\src\blitter\8bpp_base.cpp" />
|
||||
<ClInclude Include="..\src\blitter\8bpp_base.hpp" />
|
||||
<ClCompile Include="..\src\blitter\8bpp_optimized.cpp" />
|
||||
|
@@ -141,6 +141,9 @@
|
||||
<ClCompile Include="..\src\console_cmds.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\cpu.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\crashlog.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -291,9 +294,6 @@
|
||||
<ClCompile Include="..\src\order_backup.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\os_timer.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\pbs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -384,6 +384,9 @@
|
||||
<ClCompile Include="..\src\viewport.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\viewport_sprite_sorter_sse4.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\waypoint.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@@ -495,6 +498,9 @@
|
||||
<ClInclude Include="..\src\console_type.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\cpu.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\crashlog.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -1149,6 +1155,9 @@
|
||||
<ClInclude Include="..\src\viewport_func.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\viewport_sprite_sorter.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\viewport_type.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -2070,27 +2079,9 @@
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdaux.h">
|
||||
<Filter>Squirrel headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdblob.h">
|
||||
<Filter>Squirrel headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\sqstdlib\sqstdblobimpl.h">
|
||||
<Filter>Squirrel headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdio.h">
|
||||
<Filter>Squirrel headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdmath.h">
|
||||
<Filter>Squirrel headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\sqstdlib\sqstdstream.h">
|
||||
<Filter>Squirrel headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdstring.h">
|
||||
<Filter>Squirrel headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\include\sqstdsystem.h">
|
||||
<Filter>Squirrel headers</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\3rdparty\squirrel\squirrel\sqstring.h">
|
||||
<Filter>Squirrel headers</Filter>
|
||||
</ClInclude>
|
||||
@@ -2328,6 +2319,12 @@
|
||||
<ClInclude Include="..\src\script\api\script_story_page.hpp">
|
||||
<Filter>Script API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\script\api\script_storypagelist.hpp">
|
||||
<Filter>Script API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\script\api\script_storypageelementlist.hpp">
|
||||
<Filter>Script API</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\script\api\script_subsidy.hpp">
|
||||
<Filter>Script API</Filter>
|
||||
</ClInclude>
|
||||
@@ -2514,6 +2511,12 @@
|
||||
<ClCompile Include="..\src\script\api\script_story_page.cpp">
|
||||
<Filter>Script API Implementation</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\script\api\script_storypagelist.cpp">
|
||||
<Filter>Script API Implementation</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\script\api\script_storypageelementlist.cpp">
|
||||
<Filter>Script API Implementation</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\src\script\api\script_subsidy.cpp">
|
||||
<Filter>Script API Implementation</Filter>
|
||||
</ClCompile>
|
||||
@@ -2565,6 +2568,12 @@
|
||||
<ClInclude Include="..\src\blitter\32bpp_anim.hpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\src\blitter\32bpp_anim_sse4.cpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\src\blitter\32bpp_anim_sse4.hpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\src\blitter\32bpp_base.cpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClCompile>
|
||||
@@ -2583,6 +2592,30 @@
|
||||
<ClInclude Include="..\src\blitter\32bpp_simple.hpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\blitter\32bpp_sse_func.hpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\src\blitter\32bpp_sse_type.h">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\src\blitter\32bpp_sse2.cpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\src\blitter\32bpp_sse2.hpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\src\blitter\32bpp_sse4.cpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\src\blitter\32bpp_sse4.hpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\src\blitter\32bpp_ssse3.cpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClCompile>
|
||||
<ClInclude Include="..\src\blitter\32bpp_ssse3.hpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClInclude>
|
||||
<ClCompile Include="..\src\blitter\8bpp_base.cpp">
|
||||
<Filter>Blitters</Filter>
|
||||
</ClCompile>
|
||||
|
@@ -102,7 +102,7 @@
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
@@ -156,7 +156,7 @@
|
||||
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
@@ -204,7 +204,7 @@
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<ExceptionHandling>Sync</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
@@ -256,7 +256,7 @@
|
||||
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
|
@@ -52,7 +52,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -156,7 +156,7 @@
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -257,7 +257,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -362,7 +362,7 @@
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -486,6 +486,10 @@
|
||||
RelativePath=".\..\src\console_cmds.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\cpu.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\crashlog.cpp"
|
||||
>
|
||||
@@ -686,10 +690,6 @@
|
||||
RelativePath=".\..\src\order_backup.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\os_timer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\pbs.cpp"
|
||||
>
|
||||
@@ -810,6 +810,10 @@
|
||||
RelativePath=".\..\src\viewport.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\viewport_sprite_sorter_sse4.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\waypoint.cpp"
|
||||
>
|
||||
@@ -962,6 +966,10 @@
|
||||
RelativePath=".\..\src\console_type.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\cpu.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\crashlog.h"
|
||||
>
|
||||
@@ -1834,6 +1842,10 @@
|
||||
RelativePath=".\..\src\viewport_func.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\viewport_sprite_sorter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\viewport_type.h"
|
||||
>
|
||||
@@ -3102,34 +3114,10 @@
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdaux.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdblob.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\sqstdlib\sqstdblobimpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdmath.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\sqstdlib\sqstdstream.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdstring.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdsystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\squirrel\sqstring.h"
|
||||
>
|
||||
@@ -3466,6 +3454,14 @@
|
||||
RelativePath=".\..\src\script\api\script_story_page.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_storypagelist.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_storypageelementlist.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_subsidy.hpp"
|
||||
>
|
||||
@@ -3718,6 +3714,14 @@
|
||||
RelativePath=".\..\src\script\api\script_story_page.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_storypagelist.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_storypageelementlist.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_subsidy.cpp"
|
||||
>
|
||||
@@ -3790,6 +3794,14 @@
|
||||
RelativePath=".\..\src\blitter\32bpp_anim.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_anim_sse4.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_anim_sse4.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_base.cpp"
|
||||
>
|
||||
@@ -3814,6 +3826,38 @@
|
||||
RelativePath=".\..\src\blitter\32bpp_simple.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse_func.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse_type.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse2.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse2.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse4.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse4.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_ssse3.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_ssse3.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\8bpp_base.cpp"
|
||||
>
|
||||
|
@@ -52,7 +52,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -156,7 +156,7 @@
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -257,7 +257,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -362,7 +362,7 @@
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
|
@@ -53,7 +53,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -155,7 +155,7 @@
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -255,7 +255,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -359,7 +359,7 @@
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -483,6 +483,10 @@
|
||||
RelativePath=".\..\src\console_cmds.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\cpu.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\crashlog.cpp"
|
||||
>
|
||||
@@ -683,10 +687,6 @@
|
||||
RelativePath=".\..\src\order_backup.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\os_timer.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\pbs.cpp"
|
||||
>
|
||||
@@ -807,6 +807,10 @@
|
||||
RelativePath=".\..\src\viewport.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\viewport_sprite_sorter_sse4.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\waypoint.cpp"
|
||||
>
|
||||
@@ -959,6 +963,10 @@
|
||||
RelativePath=".\..\src\console_type.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\cpu.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\crashlog.h"
|
||||
>
|
||||
@@ -1831,6 +1839,10 @@
|
||||
RelativePath=".\..\src\viewport_func.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\viewport_sprite_sorter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\viewport_type.h"
|
||||
>
|
||||
@@ -3099,34 +3111,10 @@
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdaux.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdblob.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\sqstdlib\sqstdblobimpl.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdio.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdmath.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\sqstdlib\sqstdstream.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdstring.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\include\sqstdsystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\3rdparty\squirrel\squirrel\sqstring.h"
|
||||
>
|
||||
@@ -3463,6 +3451,14 @@
|
||||
RelativePath=".\..\src\script\api\script_story_page.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_storypagelist.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_storypageelementlist.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_subsidy.hpp"
|
||||
>
|
||||
@@ -3715,6 +3711,14 @@
|
||||
RelativePath=".\..\src\script\api\script_story_page.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_storypagelist.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_storypageelementlist.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\script\api\script_subsidy.cpp"
|
||||
>
|
||||
@@ -3787,6 +3791,14 @@
|
||||
RelativePath=".\..\src\blitter\32bpp_anim.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_anim_sse4.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_anim_sse4.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_base.cpp"
|
||||
>
|
||||
@@ -3811,6 +3823,38 @@
|
||||
RelativePath=".\..\src\blitter\32bpp_simple.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse_func.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse_type.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse2.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse2.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse4.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_sse4.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_ssse3.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\32bpp_ssse3.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\blitter\8bpp_base.cpp"
|
||||
>
|
||||
|
@@ -53,7 +53,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";WITH_ASSERT"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -155,7 +155,7 @@
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\""
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
@@ -255,7 +255,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="true"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64;WITH_ASSERT"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="1"
|
||||
RuntimeLibrary="0"
|
||||
@@ -359,7 +359,7 @@
|
||||
AdditionalOptions="/MP"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\"OpenTTD\";_SQ64"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="0"
|
||||
|
66
readme.txt
66
readme.txt
@@ -1,5 +1,5 @@
|
||||
Last updated: 2013-12-24
|
||||
Release version: 1.4.0-beta1
|
||||
Last updated: 2014-10-08
|
||||
Release version: 1.4.4-RC1
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -674,46 +674,47 @@ http://homer.rice.edu/~sandmann/cwsdpmi/csdpmi5s.zip
|
||||
X.X) Credits
|
||||
---- -------
|
||||
The OpenTTD team (in alphabetical order):
|
||||
Albert Hofkamp (Alberth) - GUI expert
|
||||
Jean-François Claeys (Belugas) - GUI, newindustries and more
|
||||
Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework
|
||||
Ulf Hermann (fonsinchen) - Cargo Distribution
|
||||
Christoph Elsenhans (frosch) - General coding
|
||||
Loïc Guilloux (glx) - Windows Expert
|
||||
Michael Lutz (michi_cc) - Path based signals
|
||||
Owen Rudge (orudge) - Forum host, OS/2 port
|
||||
Peter Nelson (peter1138) - Spiritual descendant from newGRF gods
|
||||
Ingo von Borstel (planetmaker) - Support
|
||||
Remko Bijker (Rubidium) - Lead coder and way more
|
||||
Zdeněk Sojka (SmatZ) - Bug finder and fixer
|
||||
José Soler (Terkhen) - General coding
|
||||
Thijs Marinussen (Yexo) - AI Framework
|
||||
Leif Linse (Zuu) - AI/Game Script
|
||||
Albert Hofkamp (Alberth) - GUI expert (since 0.7)
|
||||
Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)
|
||||
Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)
|
||||
Christoph Elsenhans (frosch) - General coding (since 0.6)
|
||||
Loïc Guilloux (glx) - Windows Expert (since 0.4.5)
|
||||
Michael Lutz (michi_cc) - Path based signals (since 0.7)
|
||||
Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)
|
||||
Peter Nelson (peter1138) - Spiritual descendant from newGRF gods (since 0.4.5)
|
||||
Ingo von Borstel (planetmaker) - General coding, Support (since 1.1)
|
||||
Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)
|
||||
José Soler (Terkhen) - General coding (since 1.0)
|
||||
Leif Linse (Zuu) - AI/Game Script (since 1.2)
|
||||
|
||||
Inactive Developers:
|
||||
Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles
|
||||
Victor Fischer (Celestar) - Programming everywhere you need him to
|
||||
Tamás Faragó (Darkvater) - Ex-Lead coder
|
||||
Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)
|
||||
Jonathan Coome (Maedhros) - High priest of the NewGRF Temple
|
||||
Attila Bán (MiHaMiX) - WebTranslator 1 and 2
|
||||
Christoph Mallon (Tron) - Programmer, code correctness police
|
||||
Jean-François Claeys (Belugas) - GUI, newindustries and more (0.4.5 - 1.0)
|
||||
Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)
|
||||
Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)
|
||||
Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)
|
||||
Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)
|
||||
Attila Bán (MiHaMiX) - WebTranslator 1 and 2 (0.3 - 0.5)
|
||||
Zdeněk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)
|
||||
Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)
|
||||
Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)
|
||||
Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)
|
||||
|
||||
Retired Developers:
|
||||
Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)
|
||||
Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)
|
||||
Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)
|
||||
Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker
|
||||
Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)
|
||||
Tamás Faragó (Darkvater) - Ex-Lead coder (0.3 - 0.5)
|
||||
Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)
|
||||
Emil Djupfeld (egladil) - MacOSX port (0.4 - 0.6)
|
||||
Simon Sasburg (HackyKid) - Bug fixer (0.4 - 0.4.5)
|
||||
Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)
|
||||
Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)
|
||||
Petr Baudiš (pasky) - Many patches, newgrf support, etc. (0.3 - 0.3)
|
||||
Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)
|
||||
Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)
|
||||
|
||||
Thanks to:
|
||||
Josef Drexler - For his great work on TTDPatch.
|
||||
Marcin Grzegorczyk - For his TTDPatch work and documentation of Transport Tycoon Deluxe internals and track foundations
|
||||
Petr Baudiš (pasky) - Many patches, newgrf support, etc.
|
||||
Simon Sasburg (HackyKid) - For the many bugfixes he has blessed us with
|
||||
Stefan Meißner (sign_de) - For his work on the console
|
||||
Mike Ragsdale - OpenTTD installer
|
||||
Cian Duffy (MYOB) - BeOS port / manual writing
|
||||
Christian Rosentreter (tokai) - MorphOS / AmigaOS port
|
||||
Richard Kempton (RichK67) - Additional airports, initial TGP implementation
|
||||
Alberto Demichelis - Squirrel scripting language
|
||||
@@ -722,6 +723,7 @@ Thanks to:
|
||||
George - Canal graphics
|
||||
Andrew Parkhouse (andythenorth) - River graphics
|
||||
David Dallaston (Pikka) - Tram tracks
|
||||
Fleashosio - Titlegame
|
||||
All Translators - For their support to make OpenTTD a truly international game
|
||||
Bug Reporters - Thanks for all bug reports
|
||||
Chris Sawyer - For an amazing game!
|
||||
|
31
source.list
31
source.list
@@ -12,6 +12,7 @@ cheat.cpp
|
||||
command.cpp
|
||||
console.cpp
|
||||
console_cmds.cpp
|
||||
cpu.cpp
|
||||
crashlog.cpp
|
||||
currency.cpp
|
||||
date.cpp
|
||||
@@ -62,7 +63,6 @@ network/network_server.cpp
|
||||
network/network_udp.cpp
|
||||
openttd.cpp
|
||||
order_backup.cpp
|
||||
os_timer.cpp
|
||||
pbs.cpp
|
||||
progress.cpp
|
||||
rail.cpp
|
||||
@@ -111,6 +111,9 @@ townname.cpp
|
||||
vehicle.cpp
|
||||
vehiclelist.cpp
|
||||
viewport.cpp
|
||||
#if SSE
|
||||
viewport_sprite_sorter_sse4.cpp
|
||||
#end
|
||||
waypoint.cpp
|
||||
widget.cpp
|
||||
window.cpp
|
||||
@@ -155,6 +158,7 @@ console_func.h
|
||||
console_gui.h
|
||||
console_internal.h
|
||||
console_type.h
|
||||
cpu.h
|
||||
crashlog.h
|
||||
currency.h
|
||||
date_func.h
|
||||
@@ -373,6 +377,7 @@ vehicle_gui_base.h
|
||||
vehicle_type.h
|
||||
vehiclelist.h
|
||||
viewport_func.h
|
||||
viewport_sprite_sorter.h
|
||||
viewport_type.h
|
||||
water.h
|
||||
waypoint_base.h
|
||||
@@ -715,13 +720,7 @@ script/squirrel_std.hpp
|
||||
3rdparty/squirrel/squirrel/sqpcheader.h
|
||||
3rdparty/squirrel/squirrel/sqstate.h
|
||||
3rdparty/squirrel/include/sqstdaux.h
|
||||
3rdparty/squirrel/include/sqstdblob.h
|
||||
3rdparty/squirrel/sqstdlib/sqstdblobimpl.h
|
||||
3rdparty/squirrel/include/sqstdio.h
|
||||
3rdparty/squirrel/include/sqstdmath.h
|
||||
3rdparty/squirrel/sqstdlib/sqstdstream.h
|
||||
3rdparty/squirrel/include/sqstdstring.h
|
||||
3rdparty/squirrel/include/sqstdsystem.h
|
||||
3rdparty/squirrel/squirrel/sqstring.h
|
||||
3rdparty/squirrel/squirrel/sqtable.h
|
||||
3rdparty/squirrel/include/squirrel.h
|
||||
@@ -811,6 +810,8 @@ script/api/script_signlist.hpp
|
||||
script/api/script_station.hpp
|
||||
script/api/script_stationlist.hpp
|
||||
script/api/script_story_page.hpp
|
||||
script/api/script_storypagelist.hpp
|
||||
script/api/script_storypageelementlist.hpp
|
||||
script/api/script_subsidy.hpp
|
||||
script/api/script_subsidylist.hpp
|
||||
script/api/script_testmode.hpp
|
||||
@@ -875,6 +876,8 @@ script/api/script_signlist.cpp
|
||||
script/api/script_station.cpp
|
||||
script/api/script_stationlist.cpp
|
||||
script/api/script_story_page.cpp
|
||||
script/api/script_storypagelist.cpp
|
||||
script/api/script_storypageelementlist.cpp
|
||||
script/api/script_subsidy.cpp
|
||||
script/api/script_subsidylist.cpp
|
||||
script/api/script_testmode.cpp
|
||||
@@ -896,12 +899,26 @@ script/api/script_window.cpp
|
||||
#else
|
||||
blitter/32bpp_anim.cpp
|
||||
blitter/32bpp_anim.hpp
|
||||
#if SSE
|
||||
blitter/32bpp_anim_sse4.cpp
|
||||
blitter/32bpp_anim_sse4.hpp
|
||||
#end
|
||||
blitter/32bpp_base.cpp
|
||||
blitter/32bpp_base.hpp
|
||||
blitter/32bpp_optimized.cpp
|
||||
blitter/32bpp_optimized.hpp
|
||||
blitter/32bpp_simple.cpp
|
||||
blitter/32bpp_simple.hpp
|
||||
#if SSE
|
||||
blitter/32bpp_sse_func.hpp
|
||||
blitter/32bpp_sse_type.h
|
||||
blitter/32bpp_sse2.cpp
|
||||
blitter/32bpp_sse2.hpp
|
||||
blitter/32bpp_sse4.cpp
|
||||
blitter/32bpp_sse4.hpp
|
||||
blitter/32bpp_ssse3.cpp
|
||||
blitter/32bpp_ssse3.hpp
|
||||
#end
|
||||
blitter/8bpp_base.cpp
|
||||
blitter/8bpp_base.hpp
|
||||
blitter/8bpp_optimized.cpp
|
||||
|
41
src/3rdparty/squirrel/COMPILE
vendored
41
src/3rdparty/squirrel/COMPILE
vendored
@@ -1,41 +0,0 @@
|
||||
Squirrel 2.2.4 stable
|
||||
--------------------------------------------------------
|
||||
What is in this distribution?
|
||||
|
||||
squirrel
|
||||
static library implementing the compiler and interpreter of the language
|
||||
|
||||
sqstdlib
|
||||
the standard utility libraries
|
||||
|
||||
sq
|
||||
stand alone interpreter
|
||||
|
||||
doc
|
||||
The manual
|
||||
|
||||
etc
|
||||
a minimalistic embedding sample
|
||||
|
||||
samples
|
||||
samples programs
|
||||
|
||||
|
||||
HOW TO COMPILE
|
||||
---------------------------------------------------------
|
||||
GCC USERS
|
||||
.........................................................
|
||||
There is a very simple makefile that compiles all libraries and exes
|
||||
from the root of the project run 'make'
|
||||
|
||||
for 32 bits systems
|
||||
|
||||
$ make
|
||||
|
||||
for 64 bits systems
|
||||
|
||||
$ make sq64
|
||||
|
||||
VISUAL C++ USERS
|
||||
.........................................................
|
||||
Open squirrel.dsw from the root project directory and build(dho!)
|
357
src/3rdparty/squirrel/HISTORY
vendored
357
src/3rdparty/squirrel/HISTORY
vendored
@@ -1,357 +0,0 @@
|
||||
***version 2.2.5 stable***
|
||||
-sq_getsize() now returns userdatasize for classes and instances
|
||||
-added parameter 'isstatic' to _newmember metamethod(thx G.Meyer)
|
||||
-now array.sort() is implemented with heapsort
|
||||
-added SQUIRREL_VERSION_NUMBER preprocessor definition
|
||||
-now floats in scientific notation also accept numbers with no '.' (eg. 1e+6 or 1e6)
|
||||
-fixed some compiler warning
|
||||
-fixed a minor compiler bug
|
||||
-fixed some bugs when SQUSEDOUBLE is used in 32bits systems
|
||||
-fixed bug in GC
|
||||
|
||||
***2009-11-15 ***
|
||||
***version 2.2.4 stable***
|
||||
-fixed bug in functions with default parameters
|
||||
|
||||
***2009-06-30 ***
|
||||
***version 2.2.3 stable***
|
||||
-added sq_getfunctioninfo
|
||||
-added compile time flag SQUSEDOUBLE to use double precision floats
|
||||
-added global slot _floatsize_ int the base lib to recognize single precision and double precision builds
|
||||
-sq_wakeupvm can now resume the vm with an exception
|
||||
-added sqstd_format
|
||||
-generators can now be instantiated by calling sq_call() or closure.call()
|
||||
-fixed a bug in sqstd_printcallstack(thx takayuki_h)
|
||||
-fixed modulo by zero(thx jup)
|
||||
-fixed negative enums and constants
|
||||
-fixed generator crash bug if invoked as tail call (thx Mr.Accident)
|
||||
-fixed some minor bug
|
||||
|
||||
***2008-09-24 ***
|
||||
***version 2.2.2 stable***
|
||||
-fixed some behaviour inconsistencies in thread.call() and thread.wakeup() (thx Mr.Accident)
|
||||
-fixed coroutine error propagation
|
||||
-fixed lingering return value from native function (thx Tom Leonard)
|
||||
-fixed a bug if array.sort() is given a bad sort function (thx Tom Leonard)
|
||||
-fixed some minor api bug
|
||||
-added sq_arrayremove() and sq_arrayinsert()
|
||||
|
||||
***2008-05-16 ***
|
||||
***version 2.2.1 stable***
|
||||
-fixed a tailcall bug
|
||||
|
||||
***2008-02-17 ***
|
||||
***version 2.2 stable ***
|
||||
-added _newslot metamethod in classes
|
||||
-added enums added constants
|
||||
-added sq_pushconsttable, sq_setconsttable
|
||||
-added default param
|
||||
-added octal literals(thx Dinosaur)
|
||||
-fixed debug hook, 'calls' and 'returns' are properly notified in the same number.
|
||||
-fixed a coroutine bug
|
||||
|
||||
***2007-07-29 ***
|
||||
***version 2.1.2 stable***
|
||||
-new behaviour for generators iteration using foreach
|
||||
now when a generator is iterated by foreach the value returned by a 'return val' statement
|
||||
will terminate the iteration but will not be returned as foreach iteration
|
||||
-added sq_setclassudsize()
|
||||
-added sq_clear()
|
||||
-added table.clear(), array.clear()
|
||||
-fixed sq_cmp() (thx jyuill)
|
||||
-fixed minor bugs
|
||||
|
||||
***2006-08-21 ***
|
||||
***version 2.1.1 stable***
|
||||
-vm refactoring
|
||||
-optimized internal function memory layout
|
||||
-new global symbol _version_ (is the version string)
|
||||
-code size optimization for float literals(on 32bits float builts)
|
||||
-now the raw ref API(sq_addref etc...) is fully reentrant.
|
||||
-fixed a bug in sq_getdelegate() now pushes null if the object doesn't have a delegate(thx MatzeB)
|
||||
-improved C reference performances in NO_GARBAGE_COLLECTOR builds
|
||||
-sq_getlocal() now enumerates also outer values.
|
||||
-fixed regexp library for GCC users.
|
||||
|
||||
***2006-03-19 ***
|
||||
***version 2.1 stable***
|
||||
-added static class fields, new keyword static
|
||||
-added 64bits architecture support
|
||||
-added global slot _intsize_ int the base lib to recognize 32bits and 64bits builds
|
||||
-added functions with fixed environment, closure.bindenv() built-in function
|
||||
-all types except userdata and null implement the tostring() method
|
||||
-string concatenation now invokes metamethod _tostring
|
||||
-new metamethods for class objects _newmember and _inherited
|
||||
-sq_call() sq_resume() sq_wakeupvm() have a new signature
|
||||
-new C referencing implementation(scales more with the amount of references)
|
||||
-refactored hash table
|
||||
-new api functions sq_newslot(),sq_tobool(),sq_getbase(), sq_instanceof(), sq_bindenv()
|
||||
-the api func sq_createslot was deprecated but still supported in form of C macro on top of sq_newslot
|
||||
-sq_setreleasehook() now also works for classes
|
||||
-stream.readstr() and stream.writestr() have been deprecated(this affects file and blob)
|
||||
-fixed squirrel.h undeclared api calls
|
||||
-fixed few minor bugs
|
||||
-SQChar is now defined as wchar_t
|
||||
-removed warning when building with -Wall -pedantic for GCC users
|
||||
-added new std io function writeclosuretofile()
|
||||
-added new std string functions strip(),rstrip(),lstrip() and split()
|
||||
-regular expressions operators (+,*) now have more POSIX greedyness behaviour
|
||||
-class constructors are now invoked as normal functions
|
||||
|
||||
***2005-10-02 ***
|
||||
***version 2.0.5 stable***
|
||||
-fixed some 64bits incompatibilities (thx sarge)
|
||||
-fixed minor bug in the stdlib format() function (thx Rick)
|
||||
-fixed a bug in dofile() that was preventing to compile empty files
|
||||
-added new API sq_poptop() & sq_getfreevariable()
|
||||
-some performance improvements
|
||||
|
||||
***2005-08-14 ***
|
||||
***version 2.0.4 stable***
|
||||
-weak references and related API calls
|
||||
-added sq_objtobool()
|
||||
-class instances memory policies improved(1 mem allocation for the whole instance)
|
||||
-typetags are now declared as SQUserPointer instead of unsigned int
|
||||
-first pass for 64bits compatibility
|
||||
-fixed minor bug in the stdio stream
|
||||
-fixed a bug in format()
|
||||
-fixed bug in string.tointeger() and string.tofloat()
|
||||
|
||||
***2005-06-24 ***
|
||||
***version 2.0.3 stable***
|
||||
-dofile() and loadfile() in the iolib now can decode ASCII, UTF8 files UCS2 big-endian and little-endian
|
||||
-sq_setparamscheck() : now typemesk can check for null
|
||||
-added string escape sequence \xhhhh
|
||||
-fixed some C++ standard incompatibilities
|
||||
|
||||
***2005-05-15 ***
|
||||
***version 2.0.2 stable***
|
||||
-performances improvements (expecially for GCC users)
|
||||
-removed all dependencies from C++ exception handling
|
||||
-various bugfixes
|
||||
|
||||
***2005-04-12 ***
|
||||
***version 2.0.1 stable***
|
||||
-various bugfixes
|
||||
-sq_setparamscheck() now allows spaces in the typemask
|
||||
|
||||
***2005-04-03 ***
|
||||
***version 2.0 stable***
|
||||
-added API sq_gettypetag()
|
||||
-added built-in function to the bool type(tointeger, tostring etc...)
|
||||
|
||||
***2005-02-27 ***
|
||||
***version 2.0 release candidate 1(RC 1)***
|
||||
-added API sq_reseterror()
|
||||
-modified sq_release()
|
||||
-now class instances can be cloned
|
||||
-various bufixes
|
||||
|
||||
***2005-01-26 ***
|
||||
***version 2.0 beta 1***
|
||||
-added bool type
|
||||
-class properties can be redefined in a derived class
|
||||
-added ops *= /= and %=
|
||||
-new syntax for class attributes declaration </ and /> instead of ( and )
|
||||
-increased the max number of literals per function from 65535 to 16777215
|
||||
-now free variables have proper lexical scoping
|
||||
-added API sq_createinstance(), sq_pushbool(), sq_getbool()
|
||||
-added built-in function type()
|
||||
-added built-in function obj.rawin(key) in table,class and instance
|
||||
-sq_rawget() and sq_rawset() now work also on classes and instances
|
||||
-the VM no longer uses C++ exception handling (more suitable for embedded devices)
|
||||
-various bufixes
|
||||
|
||||
***2004-12-21 ***
|
||||
***version 2.0 alpha 2***
|
||||
-globals scoping changed, now if :: is omitted the VM automatically falls back on the root table
|
||||
-various bufixes
|
||||
-added class level attributes
|
||||
|
||||
***2004-12-12 ***
|
||||
***version 2.0 alpha 1***
|
||||
-codebase branch from version 1.x
|
||||
-added classes
|
||||
-added functions with variable number of parameters(vargc & vargv and the ...)
|
||||
-0 and 0.0 are now considered 'false' by all conditional statements(if,while,for,?,do-while)
|
||||
-added new api functions sq_newclass() sq_setinstanceup() sq_getinstanceup() sq_getattributes() sq_setattributes()
|
||||
-modified api sq_settypetag()
|
||||
|
||||
***2004-11-01 ***
|
||||
***version 1.0 stable***
|
||||
-fixed some minor bug
|
||||
-improoved operator 'delete' performances
|
||||
-added scientific notation for float numbers( eg. 2.e16 or 2.e-2)
|
||||
|
||||
***2004-08-30 ***
|
||||
***version 1.0 release candidate 2(RC 2)***
|
||||
-fixed bug in the vm(thx Pierre Renaux)
|
||||
-fixed bug in the optimizer(thx Pierre Renaux)
|
||||
-fixed some bug in the documentation(thx JD)
|
||||
-added new api functions for raw object handling
|
||||
-removed nested multiline comments
|
||||
-reduced memory footprint in C references
|
||||
|
||||
***2004-08-23 ***
|
||||
***version 1.0 release candidate 1(RC 1)***
|
||||
-fixed division by zero
|
||||
-the 'in' operator and obj.rawget() do not query the default delegate anymore
|
||||
-added function sq_getprintfunc()
|
||||
-added new standard library 'auxlib'(implements default error handlers)
|
||||
|
||||
***2004-07-12 ***
|
||||
***version 1.0 beta 4***
|
||||
-fixed a bug in the integer.tochar() built-in method
|
||||
-fixed unary minus operator
|
||||
-fixed bug in dofile()
|
||||
-fixed inconsistency between != and == operators(on float/integer comparison)
|
||||
-added javascript style unsigned right shift operator '>>>'
|
||||
-added array(size) constructor built-in function
|
||||
-array.resize(size,[fill]) built-in function accepts an optional 'fill' value
|
||||
-improved debug API, added sq_getclosureinfo() and sq_setnativeclosurename()
|
||||
|
||||
***2004-05-23 ***
|
||||
***version 1.0 beta 3***
|
||||
-minor vm bug fixes
|
||||
-string allocation is now faster
|
||||
-tables and array memory usage is now less conservative(they shrink)
|
||||
-added regular expression routines in the standard library
|
||||
-The 'c' expression now accepts only 1 character(thx irbrian)
|
||||
-multiline strings <[ ]> have been substituted with C# style verbatim strings (eg. @"string")
|
||||
-added new keyword 'parent' for accessing the delegate of tables and unserdata
|
||||
-The metamethod '_clone' has been renamed '_cloned'
|
||||
-the _delslot metamethod's behaviour and prototype have been changed
|
||||
-new default function in the integer and float object 'tochar()'
|
||||
-the built-in function chcode2string has been removed
|
||||
-the default method [table].getdelegate() has been removed
|
||||
-new api sq_rawdeleteslot()
|
||||
-new table built-in method rawdelete(key)
|
||||
-the dynamic mudule loading has been removed from the standard distribution
|
||||
-some optimizations in the VM
|
||||
|
||||
***2004-04-21 ***
|
||||
***version 1.0 beta 2***
|
||||
-minor compiler/parser bug fixes
|
||||
-sq_newclosure has a different prototype, the "paramscheck" of paramter has been moved to the new function sq_setparamscheck()
|
||||
-sq_setparamscheck allows to add automatic parameters type checking in native closures
|
||||
-sq_compile() lost the lineinfo parameter
|
||||
-new api sq_enabledebuginfo() globally sets compiler's debug info generation
|
||||
-added consistency check on bytecode serialization
|
||||
-fixed += operator, now works on strings like +
|
||||
-added global slot in the base lib _charsize_ to recognize unicode builds from ascii builds runtime
|
||||
-added registry table
|
||||
-new api call sq_pushregistrytable()
|
||||
-added type tag to the userdata type sq_settypetag()
|
||||
-sq_getuserdata now queries the userdata typetag
|
||||
-the built in function collect_garbage() as been renamed collectgarbage() for consistency reasons
|
||||
-new standard libraries(sqlibs are now obsolete)
|
||||
|
||||
***2004-02-20 ***
|
||||
***version 1.0 beta 1***
|
||||
-fixed a bug in the compiler (thanks Martin Kofler)
|
||||
-fixed bug in the switch case statement
|
||||
-fixed the _unm metamethod
|
||||
-fixed minor bugs in the API
|
||||
-fixed automatic stack resizing
|
||||
-first beta version
|
||||
first pass code clean up in the VM and base lib
|
||||
first pass code coverege test has been done on VM and built-in lib
|
||||
-new VM creation API sq_open() sq_close() (sq_newvm and sq_releasevm are now obsolete)
|
||||
-new api allows to specifiy a "print" function to output text(sq_printfunc)
|
||||
-added some small optimizations
|
||||
-new cooperative multi-threading capabilities in the base library(coroutines), VMs are now a built in type("thread")
|
||||
-new built in functions have been added for manipulating the new "thread" type
|
||||
-friend virtual machines share the same root table, error handler and debug hook by default
|
||||
-new compile time options
|
||||
|
||||
***2004-01-19 ***
|
||||
***version 0.9 alpha***
|
||||
-fixed a garbage collection bug
|
||||
-fixed some API bugs(thanks to Joshua Jensen)
|
||||
-fixed tail calls (in the version 0.8 the tail call optimization was erroneously disabled)
|
||||
-new function parameters semantic, now passing a wrong number of parameters generates an exception
|
||||
-native closures have now a built in parameter number checking
|
||||
-sq_rawget and sq_rawset now work also on arrays
|
||||
-sq_getsize now woks also on userdata
|
||||
-the userdata release hook prototype is changed(now passes the size of the userdata)
|
||||
-the lexer reader function now returns an integer instead of a char that allows better error checking on the input(thx Joshua Jensen)
|
||||
-faster compiler
|
||||
-try/catch blocks do not cause any runtime memory allocation anymore
|
||||
|
||||
***2003-12-06 ***
|
||||
***version 0.8 alpha***
|
||||
-fixed a bug that was preventing to have callable userdata throught the metamethod _call
|
||||
-fixed a garbage collection bug
|
||||
-fixed == operator now can compare correctly different types
|
||||
-new built in method getstackinfos(level)
|
||||
-improoved line informations precision for the debug hook
|
||||
-new api call sq_compilebuffer()
|
||||
-new built-in api function compilestring()
|
||||
-new syntactic sugar for function declarations inside tables
|
||||
-the debug API has been finalized
|
||||
|
||||
***2003-11-17 ***
|
||||
***version 0.7 alpha***
|
||||
-fixed critical bug SQInteger the tail call system
|
||||
-fixed bug in the continue statement code generation
|
||||
-fixed func call param issue(thanks to Rewoonenco Andrew)
|
||||
-added _delslot metamethod(thanks to Rewoonenco Andrew)
|
||||
-new multiline string expression ( delimited by <[ and ]> )
|
||||
-normal strings ("") do not allow embedded new line anymore
|
||||
-reduced vm memory footprint(C refs are shared between friend VMs)
|
||||
-new api method sq_deleteslot()
|
||||
-new debug hook event 'r' is triggered when a function returns
|
||||
|
||||
***2003-11-04 ***
|
||||
***version 0.6 alpha***
|
||||
-fixed switch statement(was executing the default case after a break)
|
||||
-sq_call() doesn't pop the closure (just the params)
|
||||
-the vm execution can be suspended from the C API anytime (micro-threads)
|
||||
-new api calls sq_suspendvm() sq_wakeupvm() sq_getvmstate() and sq_reservestack()
|
||||
|
||||
***2003-10-13 ***
|
||||
***version 0.5 alpha***
|
||||
-fixed some minor bug
|
||||
-tested with non ASCII identifiers in unicode mode(I've tried chinese chars)
|
||||
-added built-in function string.find()
|
||||
-the built-in function array.sort() optionally accepts a cmp(a,b) function
|
||||
-the debug hook function now has a new prototype debug_hook(event_type,sourcefile,line,functionname)
|
||||
-fixed some debug info imprecision
|
||||
|
||||
***2003-10-01 ***
|
||||
***version 0.4 alpha***
|
||||
-faster VM
|
||||
-sq_call will pop arguments and closure also in case of failure
|
||||
-fixed a bug in sq_remove
|
||||
-now the VM detects delegation cycles(and throws an exception)
|
||||
-new operators ++ and --
|
||||
-new operator ',' comma operator
|
||||
-fixed some expression precedence issue
|
||||
-fixed bug in sq_arraypop
|
||||
|
||||
***2003-09-15 ***
|
||||
***version 0.3 alpha***
|
||||
-fixed a bug in array::insert()
|
||||
-optional Unicode core(define SQUNICODE or _UNICODE on Win32)
|
||||
-sq_compiler uses a new reader function SQLEXREADFUNC
|
||||
-the debug hook passes 'l' instead of 'line' for line callbacks
|
||||
and 'c' instead of 'call' for call callbacks
|
||||
-new array.extend() bulit-in function
|
||||
-new API sq_clone()
|
||||
|
||||
***2003-09-10 ***
|
||||
***version 0.2 pre-alpha***
|
||||
-new completely reentrant VM (sq_open and sq_close are now obsolete)
|
||||
-sq_newvm() has a new prototype
|
||||
-allocators are now global and linked in the VM
|
||||
-_newslot meta method added
|
||||
-rawset creates a slot if doesn't exists
|
||||
-the compiler error callback pass the vm handle(thanks Pierre Renaux)
|
||||
-sq_setforeignptr() sq_getforeingptr() are now public
|
||||
-sq_resume() now is possible to resume generators from C
|
||||
-sq_getlasterror() retrieve the last thrown error
|
||||
-improved docs
|
||||
|
||||
***2003-09-06 ***
|
||||
***version 0.1 pre-alpha***
|
||||
first release
|
23
src/3rdparty/squirrel/Makefile
vendored
23
src/3rdparty/squirrel/Makefile
vendored
@@ -1,23 +0,0 @@
|
||||
|
||||
SQUIRREL=.
|
||||
MAKE=make
|
||||
|
||||
sq32:
|
||||
cd squirrel; $(MAKE)
|
||||
cd sqstdlib; $(MAKE)
|
||||
cd sq; $(MAKE)
|
||||
|
||||
sqprof:
|
||||
cd squirrel; $(MAKE) sqprof
|
||||
cd sqstdlib; $(MAKE) sqprof
|
||||
cd sq; $(MAKE) sqprof
|
||||
|
||||
sq64:
|
||||
cd squirrel; $(MAKE) sq64
|
||||
cd sqstdlib; $(MAKE) sq64
|
||||
cd sq; $(MAKE) sq64
|
||||
|
||||
clean:
|
||||
$(MAKE) -C squirrel clean
|
||||
$(MAKE) -C sqstdlib clean
|
||||
$(MAKE) -C sq clean
|
22
src/3rdparty/squirrel/README
vendored
22
src/3rdparty/squirrel/README
vendored
@@ -1,22 +0,0 @@
|
||||
The programming language SQUIRREL 2.2.5 stable
|
||||
|
||||
--------------------------------------------------
|
||||
The project has been compiled and run on Windows(Windows XP/2000 on Intel x86 Windows XP Pro on AMD x64) and
|
||||
Linux(Slackware 9.0 on Intel x86, Fedora Core 4 on AMD x64).
|
||||
|
||||
Has been tested with the following compilers:
|
||||
MS Visual C++ 6.0,7.0,7.1 and 8.0 (32 and 64bits)
|
||||
MinGW gcc 3.2 (mingw special 20020817-1)
|
||||
Cygnus gcc 3.2
|
||||
Linux gcc 3.2.3
|
||||
Linux gcc 4.0.0 (x86 64bits)
|
||||
|
||||
|
||||
Feedback and suggestions are appreciated
|
||||
project page - http://www.squirrel-lang.org
|
||||
community forums - http://www.squirrel-lang.org/Forums
|
||||
wiki - http://wiki.squirrel-lang.org
|
||||
author - alberto@demichelis.net
|
||||
|
||||
END OF README
|
||||
|
BIN
src/3rdparty/squirrel/doc/sqstdlib2.chm
vendored
BIN
src/3rdparty/squirrel/doc/sqstdlib2.chm
vendored
Binary file not shown.
1714
src/3rdparty/squirrel/doc/sqstdlib2.pdf
vendored
1714
src/3rdparty/squirrel/doc/sqstdlib2.pdf
vendored
File diff suppressed because it is too large
Load Diff
BIN
src/3rdparty/squirrel/doc/squirrel2.chm
vendored
BIN
src/3rdparty/squirrel/doc/squirrel2.chm
vendored
Binary file not shown.
6426
src/3rdparty/squirrel/doc/squirrel2.pdf
vendored
6426
src/3rdparty/squirrel/doc/squirrel2.pdf
vendored
File diff suppressed because it is too large
Load Diff
63
src/3rdparty/squirrel/etc/minimal.c
vendored
63
src/3rdparty/squirrel/etc/minimal.c
vendored
@@ -1,63 +0,0 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <squirrel.h>
|
||||
#include <sqstdio.h>
|
||||
#include <sqstdaux.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment (lib ,"squirrel.lib")
|
||||
#pragma comment (lib ,"sqstdlib.lib")
|
||||
#endif
|
||||
|
||||
#ifdef SQUNICODE
|
||||
#define scvprintf vwprintf
|
||||
#else
|
||||
#define scvprintf vprintf
|
||||
#endif
|
||||
|
||||
void printfunc(HSQUIRRELVM v, const SQChar *s, ...)
|
||||
{
|
||||
va_list arglist;
|
||||
va_start(arglist, s);
|
||||
scvprintf(s, arglist);
|
||||
va_end(arglist);
|
||||
}
|
||||
|
||||
void call_foo(HSQUIRRELVM v, int n,float f,const SQChar *s)
|
||||
{
|
||||
SQInteger top = sq_gettop(v); //saves the stack size before the call
|
||||
sq_pushroottable(v); //pushes the global table
|
||||
sq_pushstring(v,_SC("foo"),-1);
|
||||
if(SQ_SUCCEEDED(sq_get(v,-2))) { //gets the field 'foo' from the global table
|
||||
sq_pushroottable(v); //push the 'this' (in this case is the global table)
|
||||
sq_pushinteger(v,n);
|
||||
sq_pushfloat(v,f);
|
||||
sq_pushstring(v,s,-1);
|
||||
sq_call(v,4,SQFalse,SQTrue); //calls the function
|
||||
}
|
||||
sq_settop(v,top); //restores the original stack size
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
HSQUIRRELVM v;
|
||||
v = sq_open(1024); // creates a VM with initial stack size 1024
|
||||
|
||||
//sq_pushroottable(v); //push the root table were to register the lib function
|
||||
//sqstd_register_iolib(v);
|
||||
sqstd_seterrorhandlers(v); //registers the default error handlers
|
||||
|
||||
sq_setprintfunc(v, printfunc); //sets the print function
|
||||
|
||||
sq_pushroottable(v); //push the root table(were the globals of the script will be stored)
|
||||
if(SQ_SUCCEEDED(sqstd_dofile(v, _SC("test.nut"), SQFalse, SQTrue))) // also prints syntax errors if any
|
||||
{
|
||||
call_foo(v,1,2.5,_SC("teststring"));
|
||||
}
|
||||
|
||||
sq_pop(v,1); //pops the root table
|
||||
sq_close(v);
|
||||
|
||||
return 0;
|
||||
}
|
4
src/3rdparty/squirrel/etc/test.nut
vendored
4
src/3rdparty/squirrel/etc/test.nut
vendored
@@ -1,4 +0,0 @@
|
||||
function foo(i, f, s)
|
||||
{
|
||||
print("Called foo(), i="+i+", f="+f+", s='"+s+"'\n");
|
||||
}
|
20
src/3rdparty/squirrel/include/sqstdblob.h
vendored
20
src/3rdparty/squirrel/include/sqstdblob.h
vendored
@@ -1,20 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
#ifndef _SQSTDBLOB_H_
|
||||
#define _SQSTDBLOB_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
SQUIRREL_API SQUserPointer sqstd_createblob(HSQUIRRELVM v, SQInteger size);
|
||||
SQUIRREL_API SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr);
|
||||
SQUIRREL_API SQInteger sqstd_getblobsize(HSQUIRRELVM v,SQInteger idx);
|
||||
|
||||
SQUIRREL_API SQRESULT sqstd_register_bloblib(HSQUIRRELVM v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*_SQSTDBLOB_H_*/
|
||||
|
54
src/3rdparty/squirrel/include/sqstdio.h
vendored
54
src/3rdparty/squirrel/include/sqstdio.h
vendored
@@ -1,54 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
#ifndef _SQSTDIO_H_
|
||||
#define _SQSTDIO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#define SQSTD_STREAM_TYPE_TAG 0x80000000
|
||||
|
||||
struct SQStream {
|
||||
virtual ~SQStream() {}
|
||||
virtual SQInteger Read(void *buffer, SQInteger size) = 0;
|
||||
virtual SQInteger Write(void *buffer, SQInteger size) = 0;
|
||||
virtual SQInteger Flush() = 0;
|
||||
virtual SQInteger Tell() = 0;
|
||||
virtual SQInteger Len() = 0;
|
||||
virtual SQInteger Seek(SQInteger offset, SQInteger origin) = 0;
|
||||
virtual bool IsValid() = 0;
|
||||
virtual bool EOS() = 0;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define SQ_SEEK_CUR 0
|
||||
#define SQ_SEEK_END 1
|
||||
#define SQ_SEEK_SET 2
|
||||
|
||||
typedef void* SQFILE;
|
||||
|
||||
SQUIRREL_API SQFILE sqstd_fopen(const SQChar *,const SQChar *);
|
||||
SQUIRREL_API SQInteger sqstd_fread(SQUserPointer, SQInteger, SQInteger, SQFILE);
|
||||
SQUIRREL_API SQInteger sqstd_fwrite(const SQUserPointer, SQInteger, SQInteger, SQFILE);
|
||||
SQUIRREL_API SQInteger sqstd_fseek(SQFILE , SQInteger , SQInteger);
|
||||
SQUIRREL_API SQInteger sqstd_ftell(SQFILE);
|
||||
SQUIRREL_API SQInteger sqstd_fflush(SQFILE);
|
||||
SQUIRREL_API SQInteger sqstd_fclose(SQFILE);
|
||||
SQUIRREL_API SQInteger sqstd_feof(SQFILE);
|
||||
|
||||
SQUIRREL_API SQRESULT sqstd_createfile(HSQUIRRELVM v, SQFILE file,SQBool own);
|
||||
SQUIRREL_API SQRESULT sqstd_getfile(HSQUIRRELVM v, SQInteger idx, SQFILE *file);
|
||||
|
||||
//compiler helpers
|
||||
SQUIRREL_API SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror);
|
||||
SQUIRREL_API SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror);
|
||||
SQUIRREL_API SQRESULT sqstd_writeclosuretofile(HSQUIRRELVM v,const SQChar *filename);
|
||||
|
||||
SQUIRREL_API SQRESULT sqstd_register_iolib(HSQUIRRELVM v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /*_SQSTDIO_H_*/
|
||||
|
15
src/3rdparty/squirrel/include/sqstdsystem.h
vendored
15
src/3rdparty/squirrel/include/sqstdsystem.h
vendored
@@ -1,15 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
#ifndef _SQSTD_SYSTEMLIB_H_
|
||||
#define _SQSTD_SYSTEMLIB_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
SQUIRREL_API SQInteger sqstd_register_systemlib(HSQUIRRELVM v);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif /* _SQSTD_SYSTEMLIB_H_ */
|
23
src/3rdparty/squirrel/samples/ackermann.nut
vendored
23
src/3rdparty/squirrel/samples/ackermann.nut
vendored
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
|
||||
*
|
||||
*/
|
||||
|
||||
function Ack(M, N) {
|
||||
if (M == 0) return( N + 1 );
|
||||
if (N == 0) return( Ack(M - 1, 1) );
|
||||
return( Ack(M - 1, Ack(M, (N - 1))) );
|
||||
}
|
||||
|
||||
local n;
|
||||
|
||||
if(ARGS.len()!=0) {
|
||||
n = ARGS[0].tointeger();
|
||||
if(n < 1) n = 1;
|
||||
} else {
|
||||
n = 1;
|
||||
}
|
||||
print("n="+n+"\n");
|
||||
print("Ack(3,"+ n+ "):"+ Ack(3, n));
|
||||
|
28
src/3rdparty/squirrel/samples/array.nut
vendored
28
src/3rdparty/squirrel/samples/array.nut
vendored
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
|
||||
*
|
||||
*/
|
||||
local n, i, k;
|
||||
|
||||
if(ARGS.len()!=0) {
|
||||
n = ARGS[0].tointeger();
|
||||
if(n < 1) n = 1;
|
||||
} else {
|
||||
n = 1;
|
||||
}
|
||||
|
||||
local x = []; x.resize(n);
|
||||
local y = []; y.resize(n);
|
||||
|
||||
for (i = 0; i < n; i+=1) {
|
||||
x[i] = i + 1;
|
||||
y[i] = 0;
|
||||
}
|
||||
|
||||
for (k = 0 ; k < n; k+=1) {
|
||||
for (i = n-1; i >= 0; i-=1) {
|
||||
y[i] = y[i]+ x[i];
|
||||
}
|
||||
}
|
||||
print(y[0].tostring()+" "+y[n-1]);
|
49
src/3rdparty/squirrel/samples/class.nut
vendored
49
src/3rdparty/squirrel/samples/class.nut
vendored
@@ -1,49 +0,0 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
class BaseVector {
|
||||
constructor(...)
|
||||
{
|
||||
if(vargc >= 3) {
|
||||
x = vargv[0];
|
||||
y = vargv[1];
|
||||
z = vargv[2];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
x = 0;
|
||||
y = 0;
|
||||
z = 0;
|
||||
}
|
||||
|
||||
class Vector3 extends BaseVector {
|
||||
function _add(other)
|
||||
{
|
||||
if(other instanceof this.getclass())
|
||||
return ::Vector3(x+other.x,y+other.y,z+other.z);
|
||||
else
|
||||
throw "wrong parameter";
|
||||
}
|
||||
function Print()
|
||||
{
|
||||
::print(x+","+y+","+z+"\n");
|
||||
}
|
||||
}
|
||||
|
||||
local v0 = Vector3(1,2,3)
|
||||
local v1 = Vector3(11,12,13)
|
||||
local v2 = v0 + v1;
|
||||
v2.Print();
|
||||
|
||||
FakeNamespace <- {
|
||||
Utils = {}
|
||||
}
|
||||
|
||||
class FakeNamespace.Utils.SuperClass {
|
||||
constructor()
|
||||
{
|
||||
::print("FakeNamespace.Utils.SuperClass")
|
||||
}
|
||||
}
|
||||
|
||||
local testy = FakeNamespace.Utils.SuperClass();
|
@@ -1,35 +0,0 @@
|
||||
class Foo {
|
||||
//constructor
|
||||
constructor(a)
|
||||
{
|
||||
testy = ["stuff",1,2,3];
|
||||
}
|
||||
//attributes of PrintTesty
|
||||
</ test = "freakin attribute"/>
|
||||
function PrintTesty()
|
||||
{
|
||||
foreach(i,val in testy)
|
||||
{
|
||||
::print("idx = "+i+" = "+val+" \n");
|
||||
}
|
||||
}
|
||||
//attributes of testy
|
||||
</ flippy = 10 , second = [1,2,3] />
|
||||
testy = null;
|
||||
|
||||
}
|
||||
|
||||
foreach(member,val in Foo)
|
||||
{
|
||||
::print(member+"\n");
|
||||
local attr;
|
||||
if((attr = Foo.getattributes(member)) != null) {
|
||||
foreach(i,v in attr)
|
||||
{
|
||||
::print("\t"+i+" = "+(typeof v)+"\n");
|
||||
}
|
||||
}
|
||||
else {
|
||||
::print("\t<no attributes>\n")
|
||||
}
|
||||
}
|
25
src/3rdparty/squirrel/samples/coroutines.nut
vendored
25
src/3rdparty/squirrel/samples/coroutines.nut
vendored
@@ -1,25 +0,0 @@
|
||||
function coroutine_test(a,b)
|
||||
{
|
||||
::print(a+" "+b+"\n");
|
||||
local ret = ::suspend("suspend 1");
|
||||
::print("the coroutine says "+ret+"\n");
|
||||
ret = ::suspend("suspend 2");
|
||||
::print("the coroutine says "+ret+"\n");
|
||||
ret = ::suspend("suspend 3");
|
||||
::print("the coroutine says "+ret+"\n");
|
||||
return "I'm done"
|
||||
}
|
||||
|
||||
local coro = ::newthread(coroutine_test);
|
||||
|
||||
local susparam = coro.call("test","coroutine"); //starts the coroutine
|
||||
|
||||
local i = 1;
|
||||
do
|
||||
{
|
||||
::print("suspend passed ["+susparam+"]\n")
|
||||
susparam = coro.wakeup("ciao "+i);
|
||||
++i;
|
||||
}while(coro.getstatus()=="suspended")
|
||||
|
||||
::print("return passed ["+susparam+"]\n")
|
52
src/3rdparty/squirrel/samples/delegation.nut
vendored
52
src/3rdparty/squirrel/samples/delegation.nut
vendored
@@ -1,52 +0,0 @@
|
||||
|
||||
PEntity <- {
|
||||
name="noname"
|
||||
pos={x=0,y=0,z=0}
|
||||
type="entity"
|
||||
//methamethod
|
||||
_typeof=function()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
function PEntity::PrintPos()
|
||||
{
|
||||
::print("x="+pos.x+" y="+pos.y+" z="+pos.z+"\n");
|
||||
}
|
||||
|
||||
function PEntity::new(name,pos)
|
||||
{
|
||||
local newentity=clone ::PEntity;
|
||||
if(name)
|
||||
newentity.name=name;
|
||||
if(pos)
|
||||
newentity.pos=pos;
|
||||
return newentity;
|
||||
}
|
||||
|
||||
PPlayer <- {
|
||||
model="warrior.mdl"
|
||||
weapon="fist"
|
||||
health=100
|
||||
armor=0
|
||||
//overrides the parent type
|
||||
type="player"
|
||||
}
|
||||
|
||||
function PPlayer::new(name,pos)
|
||||
{
|
||||
local newplayer=delegate ::PEntity.new(name,pos) : clone ::PPlayer;
|
||||
return newplayer;
|
||||
}
|
||||
|
||||
local player=PPlayer.new("godzilla",{x=10,y=20,z=30});
|
||||
|
||||
::print("PLAYER NAME"+player.name+"\n");
|
||||
::print("ENTITY TYPE"+typeof player+"\n");
|
||||
|
||||
player.PrintPos();
|
||||
|
||||
player.pos.x=123;
|
||||
|
||||
player.PrintPos();
|
15
src/3rdparty/squirrel/samples/fibonacci.nut
vendored
15
src/3rdparty/squirrel/samples/fibonacci.nut
vendored
@@ -1,15 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
|
||||
*
|
||||
*/
|
||||
|
||||
function fib(n)
|
||||
{
|
||||
if (n < 2) return 1
|
||||
return fib(n-2) + fib(n-1)
|
||||
}
|
||||
|
||||
local n = ARGS.len()!=0?ARGS[0].tointeger():1
|
||||
|
||||
print(fib(n)+"\n")
|
33
src/3rdparty/squirrel/samples/flow.nut
vendored
33
src/3rdparty/squirrel/samples/flow.nut
vendored
@@ -1,33 +0,0 @@
|
||||
function min(x,y)
|
||||
return x<y?x:y;
|
||||
|
||||
function max(x,y)
|
||||
return x>y?x:y;
|
||||
|
||||
if(min(100,200)>max(50,20))
|
||||
print("I'm useless statement just to show up the if/else\n");
|
||||
else
|
||||
print("squirrel!!\n");
|
||||
|
||||
print("\n")
|
||||
|
||||
function typy(obj)
|
||||
{
|
||||
switch(typeof obj)
|
||||
{
|
||||
case "integer":
|
||||
case "float":
|
||||
return "is a number";
|
||||
case "table":
|
||||
case "array":
|
||||
return "is a container";
|
||||
default:
|
||||
return "is other stuff"
|
||||
}
|
||||
}
|
||||
|
||||
local a=1,b={},c=function(a,b){return a+b;}
|
||||
|
||||
print("a "+typy(a)+"\n");
|
||||
print("b "+typy(b)+"\n");
|
||||
print("c "+typy(c)+"\n");
|
42
src/3rdparty/squirrel/samples/generators.nut
vendored
42
src/3rdparty/squirrel/samples/generators.nut
vendored
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
*Random number function from The Great Computer Language shootout
|
||||
*converted to a generator func
|
||||
*/
|
||||
|
||||
function gen_random(max) {
|
||||
local last=42
|
||||
local IM = 139968;
|
||||
local IA = 3877;
|
||||
local IC = 29573;
|
||||
for(;;){ //loops forever
|
||||
yield (max * (last = (last * IA + IC) % IM) / IM);
|
||||
}
|
||||
}
|
||||
|
||||
local randtor=gen_random(100);
|
||||
|
||||
print("RAND NUMBERS \n")
|
||||
|
||||
for(local i=0;i<10;i+=1)
|
||||
print(">"+resume randtor+"\n");
|
||||
|
||||
print("FIBONACCI \n")
|
||||
function fiboz(n)
|
||||
{
|
||||
local prev=0;
|
||||
local curr=1;
|
||||
yield 1;
|
||||
|
||||
for(local i=0;i<n-1;i+=1)
|
||||
{
|
||||
local res=prev+curr;
|
||||
prev=curr;
|
||||
yield curr=res;
|
||||
}
|
||||
return prev+curr;
|
||||
}
|
||||
|
||||
foreach(val in fiboz(10))
|
||||
{
|
||||
::print(">"+val+"\n");
|
||||
}
|
1
src/3rdparty/squirrel/samples/hello.nut
vendored
1
src/3rdparty/squirrel/samples/hello.nut
vendored
@@ -1 +0,0 @@
|
||||
print("Hello World!")
|
39
src/3rdparty/squirrel/samples/list.nut
vendored
39
src/3rdparty/squirrel/samples/list.nut
vendored
@@ -1,39 +0,0 @@
|
||||
/*translation of the list test from The Great Computer Language Shootout
|
||||
*/
|
||||
|
||||
function compare_arr(a1,a2)
|
||||
{
|
||||
foreach(i,val in a1)
|
||||
if(val!=a2[i])return null;
|
||||
return 1;
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
local size=10000
|
||||
local l1=[]; l1.resize(size);
|
||||
for(local i=0;i<size;i+=1) l1[i]=i;
|
||||
local l2=clone l1;
|
||||
local l3=[]
|
||||
|
||||
l2.reverse();
|
||||
while(l2.len()>0)
|
||||
l3.append(l2.pop());
|
||||
while(l3.len()>0)
|
||||
l2.append(l3.pop());
|
||||
l1.reverse();
|
||||
|
||||
if(compare_arr(l1,l2))
|
||||
return l1.len();
|
||||
return null;
|
||||
}
|
||||
|
||||
local n = ARGS.len()!=0?ARGS[0].tointeger():1
|
||||
for(local i=0;i<n;i+=1)
|
||||
if(!test())
|
||||
{
|
||||
print("failed");
|
||||
return;
|
||||
}
|
||||
|
||||
print("oki doki");
|
32
src/3rdparty/squirrel/samples/loops.nut
vendored
32
src/3rdparty/squirrel/samples/loops.nut
vendored
@@ -1,32 +0,0 @@
|
||||
local arr=["one","two","three"]
|
||||
|
||||
::print("FOREACH\n");
|
||||
|
||||
foreach(i,val in arr)
|
||||
{
|
||||
::print("index ["+i+"]="+val+"\n");
|
||||
}
|
||||
|
||||
::print("FOR\n");
|
||||
|
||||
for(local i=0;i<arr.len();i+=1)
|
||||
{
|
||||
::print("index ["+i+"]="+arr[i]+"\n");
|
||||
}
|
||||
|
||||
::print("WHILE\n");
|
||||
|
||||
local i=0;
|
||||
while(i<arr.len())
|
||||
{
|
||||
::print("index ["+i+"]="+arr[i]+"\n");
|
||||
i+=1;
|
||||
}
|
||||
::print("DO WHILE\n");
|
||||
|
||||
local i=0;
|
||||
do
|
||||
{
|
||||
::print("index ["+i+"]="+arr[i]+"\n");
|
||||
i+=1;
|
||||
}while(i<arr.len());
|
44
src/3rdparty/squirrel/samples/matrix.nut
vendored
44
src/3rdparty/squirrel/samples/matrix.nut
vendored
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* Original Javascript version by David Hedbor(http://www.bagley.org/~doug/shootout/)
|
||||
*
|
||||
*/
|
||||
local SIZE=30;
|
||||
|
||||
function mkmatrix(rows, cols) {
|
||||
local i, j, count = 1;
|
||||
local m = []; m.resize(rows);
|
||||
for (i = 0; i < rows; i+=1) {
|
||||
m[i] = [];m[i].resize(cols)
|
||||
for (j = 0; j < cols; j+=1) {
|
||||
m[i][j] = count+=1;
|
||||
}
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
function mmult(rows, cols, m1, m2, m3) {
|
||||
local i, j, k, val;
|
||||
for (i = 0; i < rows; i+=1) {
|
||||
for (j = 0; j < cols; j+=1) {
|
||||
val = 0;
|
||||
for (k = 0; k < cols; k+=1) {
|
||||
val += m1[i][k] * m2[k][j];
|
||||
}
|
||||
m3[i][j] = val;
|
||||
}
|
||||
}
|
||||
return m3;
|
||||
}
|
||||
|
||||
local n = ARGS.len()!=0?ARGS[0].tointeger():1
|
||||
|
||||
local m1 = mkmatrix(SIZE, SIZE);
|
||||
local m2 = mkmatrix(SIZE, SIZE);
|
||||
local mm = mkmatrix(SIZE, SIZE);
|
||||
|
||||
for (local i = 0; i < n; i+=1) {
|
||||
mmult(SIZE, SIZE, m1, m2, mm);
|
||||
}
|
||||
|
||||
print(mm[0][0]+" "+mm[2][3]+" "+mm[3][2]+" "+mm[4][4]);
|
115
src/3rdparty/squirrel/samples/metamethods.nut
vendored
115
src/3rdparty/squirrel/samples/metamethods.nut
vendored
@@ -1,115 +0,0 @@
|
||||
|
||||
local base_vec={
|
||||
function _add(n)
|
||||
{
|
||||
return {
|
||||
x=x+n.x,
|
||||
y=y+n.y,
|
||||
z=z+n.z,
|
||||
}
|
||||
}
|
||||
function _sub(n)
|
||||
{
|
||||
return {
|
||||
x=x-n.x,
|
||||
y=y-n.y,
|
||||
z=z-n.z,
|
||||
}
|
||||
}
|
||||
function _div(n)
|
||||
{
|
||||
return {
|
||||
x=x/n.x,
|
||||
y=y/n.y,
|
||||
z=z/n.z,
|
||||
}
|
||||
}
|
||||
function _mul(n)
|
||||
{
|
||||
return {
|
||||
x=x*n.x,
|
||||
y=y*n.y,
|
||||
z=z*n.z,
|
||||
}
|
||||
}
|
||||
function _modulo(n)
|
||||
{
|
||||
return {
|
||||
x=x%n,
|
||||
y=y%n,
|
||||
z=z%n,
|
||||
}
|
||||
}
|
||||
function _typeof() {return "vector";}
|
||||
function _get(key)
|
||||
{
|
||||
if(key==100)
|
||||
{
|
||||
return test_field;
|
||||
}
|
||||
},
|
||||
function _set(key,val)
|
||||
{
|
||||
::print("key = "+key+"\n");
|
||||
::print("val = "+val+"\n")
|
||||
if(key==100)
|
||||
{
|
||||
return test_field=val;
|
||||
}
|
||||
}
|
||||
test_field="nothing"
|
||||
}
|
||||
|
||||
function vector(_x,_y,_z):(base_vec)
|
||||
{
|
||||
return delegate base_vec : {x=_x,y=_y,z=_z }
|
||||
}
|
||||
////////////////////////////////////////////////////////////
|
||||
|
||||
local v1=vector(1.5,2.5,3.5);
|
||||
local v2=vector(1.5,2.5,3.5);
|
||||
|
||||
local r=v1+v2;
|
||||
|
||||
|
||||
foreach(i,val in r)
|
||||
{
|
||||
print(i+" = "+val+"\n");
|
||||
}
|
||||
|
||||
r=v1*v2;
|
||||
|
||||
foreach(i,val in r)
|
||||
{
|
||||
print(i+" = "+val+"\n");
|
||||
}
|
||||
|
||||
r=v1/v2;
|
||||
|
||||
foreach(i,val in r)
|
||||
{
|
||||
print(i+" = "+val+"\n");
|
||||
}
|
||||
|
||||
r=v1-v2;
|
||||
|
||||
foreach(i,val in r)
|
||||
{
|
||||
print(i+" = "+val+"\n");
|
||||
}
|
||||
|
||||
r=v1%2;
|
||||
|
||||
foreach(i,val in r)
|
||||
{
|
||||
print(i+" = "+val+"\n");
|
||||
}
|
||||
|
||||
print(v1[100]+"\n");
|
||||
v1[100]="set SUCCEEDED";
|
||||
print(v1[100]+"\n");
|
||||
|
||||
if(typeof v1=="vector")
|
||||
print("<SUCCEEDED>\n");
|
||||
else
|
||||
print("<FAILED>\n");
|
61
src/3rdparty/squirrel/samples/methcall.nut
vendored
61
src/3rdparty/squirrel/samples/methcall.nut
vendored
@@ -1,61 +0,0 @@
|
||||
/*translation of the methcall test from The Great Computer Language Shootout
|
||||
*/
|
||||
|
||||
Toggle <- {
|
||||
bool=null
|
||||
}
|
||||
|
||||
function Toggle::value() {
|
||||
return bool;
|
||||
}
|
||||
|
||||
function Toggle::activate() {
|
||||
bool = !bool;
|
||||
return this;
|
||||
}
|
||||
|
||||
function Toggle::new(startstate) {
|
||||
local newo=clone this;
|
||||
newo.bool = startstate;
|
||||
return newo;
|
||||
}
|
||||
|
||||
NthToggle <- {
|
||||
count_max=null
|
||||
count=0
|
||||
}
|
||||
|
||||
function NthToggle::new(start_state,max_counter)
|
||||
{
|
||||
local newo=delegate ::Toggle.new(start_state) : clone this;
|
||||
newo.count_max <- max_counter
|
||||
return newo;
|
||||
}
|
||||
|
||||
function NthToggle::activate ()
|
||||
{
|
||||
count+=1
|
||||
if (count >= count_max) {
|
||||
bool = !bool;
|
||||
count = 0;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
local n = ARGS.len()!=0?ARGS[0].tointeger():1
|
||||
|
||||
local val = 1;
|
||||
local toggle = Toggle.new(val);
|
||||
for (local i=0; i<n; i+=1) {
|
||||
val = toggle.activate().value();
|
||||
|
||||
}
|
||||
print(toggle.value() ? "true\n" : "false\n");
|
||||
|
||||
val = 1;
|
||||
local ntoggle = NthToggle.new(val, 3);
|
||||
for (local i=0; i<n; i+=1) {
|
||||
val = ntoggle.activate().value();
|
||||
}
|
||||
print(ntoggle.value() ? "true\n" : "false\n");
|
24
src/3rdparty/squirrel/samples/tailstate.nut
vendored
24
src/3rdparty/squirrel/samples/tailstate.nut
vendored
@@ -1,24 +0,0 @@
|
||||
function state1()
|
||||
{
|
||||
::suspend("state1");
|
||||
return state2();
|
||||
}
|
||||
|
||||
function state2()
|
||||
{
|
||||
::suspend("state2");
|
||||
return state3();
|
||||
}
|
||||
|
||||
function state3()
|
||||
{
|
||||
::suspend("state3");
|
||||
return state1();
|
||||
}
|
||||
|
||||
local statethread = ::newthread(state1)
|
||||
|
||||
::print(statethread.call()+"\n");
|
||||
|
||||
for(local i = 0; i < 10000; i++)
|
||||
::print(statethread.wakeup()+"\n");
|
24
src/3rdparty/squirrel/sq/Makefile
vendored
24
src/3rdparty/squirrel/sq/Makefile
vendored
@@ -1,24 +0,0 @@
|
||||
SQUIRREL= ..
|
||||
|
||||
|
||||
OUT= $(SQUIRREL)/bin/sq
|
||||
INCZ= -I$(SQUIRREL)/include -I. -I$(SQUIRREL)/sqlibs
|
||||
LIBZ= -L$(SQUIRREL)/lib
|
||||
LIB= -lsquirrel -lsqstdlib
|
||||
|
||||
OBJS= sq.o
|
||||
|
||||
SRCS= sq.c
|
||||
|
||||
|
||||
sq32:
|
||||
g++ -O2 -fno-rtti -o $(OUT) $(SRCS) $(INCZ) $(LIBZ) $(LIB)
|
||||
|
||||
sqprof:
|
||||
g++ -O2 -pg -fno-rtti -pie -gstabs -g3 -o $(OUT) $(SRCS) $(INCZ) $(LIBZ) $(LIB)
|
||||
|
||||
sq64:
|
||||
g++ -O2 -fno-rtti -D_SQ64 -o $(OUT) $(SRCS) $(INCZ) $(LIBZ) $(LIB)
|
||||
|
||||
clean:
|
||||
rm -f $(OUT)
|
324
src/3rdparty/squirrel/sq/sq.c
vendored
324
src/3rdparty/squirrel/sq/sq.c
vendored
@@ -1,324 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
#include <crtdbg.h>
|
||||
#include <conio.h>
|
||||
#endif
|
||||
#include <squirrel.h>
|
||||
#include <sqstdblob.h>
|
||||
#include <sqstdsystem.h>
|
||||
#include <sqstdio.h>
|
||||
#include <sqstdmath.h>
|
||||
#include <sqstdstring.h>
|
||||
#include <sqstdaux.h>
|
||||
|
||||
#ifdef SQUNICODE
|
||||
#define scfprintf fwprintf
|
||||
#define scfopen _wfopen
|
||||
#define scvprintf vwprintf
|
||||
#else
|
||||
#define scfprintf fprintf
|
||||
#define scfopen fopen
|
||||
#define scvprintf vprintf
|
||||
#endif
|
||||
|
||||
|
||||
void PrintVersionInfos();
|
||||
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
int MemAllocHook( int allocType, void *userData, size_t size, int blockType,
|
||||
long requestNumber, const unsigned char *filename, int lineNumber)
|
||||
{
|
||||
// if(requestNumber==585)_asm int 3;
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
SQInteger quit(HSQUIRRELVM v)
|
||||
{
|
||||
int *done;
|
||||
sq_getuserpointer(v,-1,(SQUserPointer*)&done);
|
||||
*done=1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void printfunc(HSQUIRRELVM v,const SQChar *s,...)
|
||||
{
|
||||
va_list vl;
|
||||
va_start(vl, s);
|
||||
scvprintf( s, vl);
|
||||
va_end(vl);
|
||||
}
|
||||
|
||||
void PrintVersionInfos()
|
||||
{
|
||||
scfprintf(stdout,_SC("%s %s (%d bits)\n"),SQUIRREL_VERSION,SQUIRREL_COPYRIGHT,sizeof(SQInteger)*8);
|
||||
if(sizeof(SQFloat) != sizeof(float)) {
|
||||
scfprintf(stdout,_SC("[%d bits floats]\n"),sizeof(SQFloat)*8);
|
||||
}
|
||||
}
|
||||
|
||||
void PrintUsage()
|
||||
{
|
||||
scfprintf(stderr,_SC("usage: sq <options> <scriptpath [args]>.\n")
|
||||
_SC("Available options are:\n")
|
||||
_SC(" -c compiles the file to bytecode(default output 'out.cnut')\n")
|
||||
_SC(" -o specifies output file for the -c option\n")
|
||||
_SC(" -c compiles only\n")
|
||||
_SC(" -d generates debug infos\n")
|
||||
_SC(" -v displays version infos\n")
|
||||
_SC(" -h prints help\n"));
|
||||
}
|
||||
|
||||
#define _INTERACTIVE 0
|
||||
#define _DONE 2
|
||||
//<<FIXME>> this func is a mess
|
||||
int getargs(HSQUIRRELVM v,int argc, char* argv[])
|
||||
{
|
||||
int i;
|
||||
int compiles_only = 0;
|
||||
static SQChar temp[500];
|
||||
const SQChar *ret=NULL;
|
||||
char * output = NULL;
|
||||
int lineinfo=0;
|
||||
if(argc>1)
|
||||
{
|
||||
int arg=1,exitloop=0;
|
||||
while(arg < argc && !exitloop)
|
||||
{
|
||||
|
||||
if(argv[arg][0]=='-')
|
||||
{
|
||||
switch(argv[arg][1])
|
||||
{
|
||||
case 'd': //DEBUG(debug infos)
|
||||
sq_enabledebuginfo(v,1);
|
||||
break;
|
||||
case 'c':
|
||||
compiles_only = 1;
|
||||
break;
|
||||
case 'o':
|
||||
if(arg < argc) {
|
||||
arg++;
|
||||
output = argv[arg];
|
||||
}
|
||||
break;
|
||||
case 'v':
|
||||
PrintVersionInfos();
|
||||
return _DONE;
|
||||
|
||||
case 'h':
|
||||
PrintVersionInfos();
|
||||
PrintUsage();
|
||||
return _DONE;
|
||||
default:
|
||||
PrintVersionInfos();
|
||||
scprintf(_SC("unknown prameter '-%c'\n"),argv[arg][1]);
|
||||
PrintUsage();
|
||||
return _DONE;
|
||||
}
|
||||
}else break;
|
||||
arg++;
|
||||
}
|
||||
|
||||
// src file
|
||||
|
||||
if(arg<argc) {
|
||||
const SQChar *filename=NULL;
|
||||
#ifdef SQUNICODE
|
||||
mbstowcs(temp,argv[arg],strlen(argv[arg]));
|
||||
filename=temp;
|
||||
#else
|
||||
filename=argv[arg];
|
||||
#endif
|
||||
|
||||
arg++;
|
||||
sq_pushroottable(v);
|
||||
sq_pushstring(v,_SC("ARGS"),-1);
|
||||
sq_newarray(v,0);
|
||||
for(i=arg;i<argc;i++)
|
||||
{
|
||||
const SQChar *a;
|
||||
#ifdef SQUNICODE
|
||||
int alen=(int)strlen(argv[i]);
|
||||
a=sq_getscratchpad(v,(int)(alen*sizeof(SQChar)));
|
||||
mbstowcs(sq_getscratchpad(v,-1),argv[i],alen);
|
||||
sq_getscratchpad(v,-1)[alen] = _SC('\0');
|
||||
#else
|
||||
a=argv[i];
|
||||
#endif
|
||||
sq_pushstring(v,a,-1);
|
||||
|
||||
sq_arrayappend(v,-2);
|
||||
}
|
||||
sq_createslot(v,-3);
|
||||
sq_pop(v,1);
|
||||
if(compiles_only) {
|
||||
if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,SQTrue))){
|
||||
SQChar *outfile = _SC("out.cnut");
|
||||
if(output) {
|
||||
#ifdef SQUNICODE
|
||||
int len = (int)(strlen(output)+1);
|
||||
mbstowcs(sq_getscratchpad(v,len*sizeof(SQChar)),output,len);
|
||||
outfile = sq_getscratchpad(v,-1);
|
||||
#else
|
||||
outfile = output;
|
||||
#endif
|
||||
}
|
||||
if(SQ_SUCCEEDED(sqstd_writeclosuretofile(v,outfile)))
|
||||
return _DONE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(SQ_SUCCEEDED(sqstd_dofile(v,filename,SQFalse,SQTrue))) {
|
||||
return _DONE;
|
||||
}
|
||||
}
|
||||
//if this point is reached an error occured
|
||||
{
|
||||
const SQChar *err;
|
||||
sq_getlasterror(v);
|
||||
if(SQ_SUCCEEDED(sq_getstring(v,-1,&err))) {
|
||||
scprintf(_SC("Error [%s]\n"),err);
|
||||
return _DONE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return _INTERACTIVE;
|
||||
}
|
||||
|
||||
void Interactive(HSQUIRRELVM v)
|
||||
{
|
||||
|
||||
#define MAXINPUT 1024
|
||||
SQChar buffer[MAXINPUT];
|
||||
SQInteger blocks =0;
|
||||
SQInteger string=0;
|
||||
SQInteger retval=0;
|
||||
SQInteger done=0;
|
||||
PrintVersionInfos();
|
||||
|
||||
sq_pushroottable(v);
|
||||
sq_pushstring(v,_SC("quit"),-1);
|
||||
sq_pushuserpointer(v,&done);
|
||||
sq_newclosure(v,quit,1);
|
||||
sq_setparamscheck(v,1,NULL);
|
||||
sq_createslot(v,-3);
|
||||
sq_pop(v,1);
|
||||
|
||||
while (!done)
|
||||
{
|
||||
SQInteger i = 0;
|
||||
scprintf(_SC("\nsq>"));
|
||||
for(;;) {
|
||||
int c;
|
||||
if(done)return;
|
||||
c = getchar();
|
||||
if (c == _SC('\n')) {
|
||||
if (i>0 && buffer[i-1] == _SC('\\'))
|
||||
{
|
||||
buffer[i-1] = _SC('\n');
|
||||
}
|
||||
else if(blocks==0)break;
|
||||
buffer[i++] = _SC('\n');
|
||||
}
|
||||
else if (c==_SC('}')) {blocks--; buffer[i++] = (SQChar)c;}
|
||||
else if(c==_SC('{') && !string){
|
||||
blocks++;
|
||||
buffer[i++] = (SQChar)c;
|
||||
}
|
||||
else if(c==_SC('"') || c==_SC('\'')){
|
||||
string=!string;
|
||||
buffer[i++] = (SQChar)c;
|
||||
}
|
||||
else if (i >= MAXINPUT-1) {
|
||||
scfprintf(stderr, _SC("sq : input line too long\n"));
|
||||
break;
|
||||
}
|
||||
else{
|
||||
buffer[i++] = (SQChar)c;
|
||||
}
|
||||
}
|
||||
buffer[i] = _SC('\0');
|
||||
|
||||
if(buffer[0]==_SC('=')){
|
||||
scsprintf(sq_getscratchpad(v,MAXINPUT),_SC("return (%s)"),&buffer[1]);
|
||||
memcpy(buffer,sq_getscratchpad(v,-1),(scstrlen(sq_getscratchpad(v,-1))+1)*sizeof(SQChar));
|
||||
retval=1;
|
||||
}
|
||||
i=scstrlen(buffer);
|
||||
if(i>0){
|
||||
SQInteger oldtop=sq_gettop(v);
|
||||
if(SQ_SUCCEEDED(sq_compilebuffer(v,buffer,i,_SC("interactive console"),SQTrue))){
|
||||
sq_pushroottable(v);
|
||||
if(SQ_SUCCEEDED(sq_call(v,1,retval,SQTrue)) && retval){
|
||||
scprintf(_SC("\n"));
|
||||
sq_pushroottable(v);
|
||||
sq_pushstring(v,_SC("print"),-1);
|
||||
sq_get(v,-2);
|
||||
sq_pushroottable(v);
|
||||
sq_push(v,-4);
|
||||
sq_call(v,2,SQFalse,SQTrue);
|
||||
retval=0;
|
||||
scprintf(_SC("\n"));
|
||||
}
|
||||
}
|
||||
|
||||
sq_settop(v,oldtop);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
HSQUIRRELVM v;
|
||||
|
||||
const SQChar *filename=NULL;
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
_CrtSetAllocHook(MemAllocHook);
|
||||
#endif
|
||||
|
||||
v=sq_open(1024);
|
||||
sq_setprintfunc(v,printfunc);
|
||||
|
||||
sq_pushroottable(v);
|
||||
|
||||
sqstd_register_bloblib(v);
|
||||
sqstd_register_iolib(v);
|
||||
sqstd_register_systemlib(v);
|
||||
sqstd_register_mathlib(v);
|
||||
sqstd_register_stringlib(v);
|
||||
|
||||
//aux library
|
||||
//sets error handlers
|
||||
sqstd_seterrorhandlers(v);
|
||||
|
||||
//gets arguments
|
||||
switch(getargs(v,argc,argv))
|
||||
{
|
||||
case _INTERACTIVE:
|
||||
Interactive(v);
|
||||
break;
|
||||
case _DONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
sq_close(v);
|
||||
|
||||
#if defined(_MSC_VER) && defined(_DEBUG)
|
||||
_getch();
|
||||
_CrtMemDumpAllObjectsSince( NULL );
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
101
src/3rdparty/squirrel/sq/sq.dsp
vendored
101
src/3rdparty/squirrel/sq/sq.dsp
vendored
@@ -1,101 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="sq" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Console Application" 0x0103
|
||||
|
||||
CFG=sq - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "sq.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "sq.mak" CFG="sq - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "sq - Win32 Release" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE "sq - Win32 Debug" (based on "Win32 (x86) Console Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_LocalPath ".."
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "sq - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /I "..\sqstdlib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
||||
# ADD RSC /l 0x410 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
|
||||
# ADD LINK32 squirrel.lib sqstdlib.lib /nologo /subsystem:console /machine:I386 /out:"../bin/sq.exe" /libpath:"../lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "sq - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\include" /I "..\sqstdlib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x410 /d "_DEBUG"
|
||||
# ADD RSC /l 0x410 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 squirrel.lib sqstdlib.lib /nologo /subsystem:console /debug /machine:I386 /out:"../bin/sq.exe" /pdbtype:sept /libpath:"../lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "sq - Win32 Release"
|
||||
# Name "sq - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sq.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
31
src/3rdparty/squirrel/sqstdlib/Makefile
vendored
31
src/3rdparty/squirrel/sqstdlib/Makefile
vendored
@@ -1,31 +0,0 @@
|
||||
SQUIRREL= ..
|
||||
|
||||
|
||||
OUT= $(SQUIRREL)/lib/libsqstdlib.a
|
||||
INCZ= -I$(SQUIRREL)/include -I. -Iinclude
|
||||
|
||||
SRCS= \
|
||||
sqstdblob.cpp \
|
||||
sqstdio.cpp \
|
||||
sqstdstream.cpp \
|
||||
sqstdmath.cpp \
|
||||
sqstdsystem.cpp \
|
||||
sqstdstring.cpp \
|
||||
sqstdaux.cpp \
|
||||
sqstdrex.cpp
|
||||
|
||||
|
||||
sq32:
|
||||
gcc -O2 -fno-rtti -Wall -c $(SRCS) $(INCZ)
|
||||
ar rc $(OUT) *.o
|
||||
|
||||
sqprof:
|
||||
gcc -O2 -pg -fno-rtti -pie -gstabs -g3 -Wall -c $(SRCS) $(INCZ)
|
||||
ar rc $(OUT) *.o
|
||||
|
||||
sq64:
|
||||
gcc -O2 -D_SQ64 -fno-rtti -Wall -c $(SRCS) $(INCZ)
|
||||
ar rc $(OUT) *.o
|
||||
|
||||
clean:
|
||||
rm -f $(OUT) $(SRCS:%.cpp=%.o)
|
251
src/3rdparty/squirrel/sqstdlib/sqstdblob.cpp
vendored
251
src/3rdparty/squirrel/sqstdlib/sqstdblob.cpp
vendored
@@ -1,251 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
#include <new>
|
||||
#include <squirrel.h>
|
||||
#include <sqstdio.h>
|
||||
#include <string.h>
|
||||
#include <sqstdblob.h>
|
||||
#include "sqstdstream.h"
|
||||
#include "sqstdblobimpl.h"
|
||||
|
||||
#define SQSTD_BLOB_TYPE_TAG (SQSTD_STREAM_TYPE_TAG | 0x00000002)
|
||||
|
||||
//Blob
|
||||
|
||||
|
||||
#define SETUP_BLOB(v) \
|
||||
SQBlob *self = NULL; \
|
||||
{ if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_BLOB_TYPE_TAG))) \
|
||||
return SQ_ERROR; }
|
||||
|
||||
|
||||
static SQInteger _blob_resize(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_BLOB(v);
|
||||
SQInteger size;
|
||||
sq_getinteger(v,2,&size);
|
||||
if(!self->Resize(size))
|
||||
return sq_throwerror(v,_SC("resize failed"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __swap_dword(unsigned int *n)
|
||||
{
|
||||
*n=(unsigned int)(((*n&0xFF000000)>>24) |
|
||||
((*n&0x00FF0000)>>8) |
|
||||
((*n&0x0000FF00)<<8) |
|
||||
((*n&0x000000FF)<<24));
|
||||
}
|
||||
|
||||
static void __swap_word(unsigned short *n)
|
||||
{
|
||||
*n=(unsigned short)((*n>>8)&0x00FF)| ((*n<<8)&0xFF00);
|
||||
}
|
||||
|
||||
static SQInteger _blob_swap4(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_BLOB(v);
|
||||
SQInteger num=(self->Len()-(self->Len()%4))>>2;
|
||||
unsigned int *t=(unsigned int *)self->GetBuf();
|
||||
for(SQInteger i = 0; i < num; i++) {
|
||||
__swap_dword(&t[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SQInteger _blob_swap2(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_BLOB(v);
|
||||
SQInteger num=(self->Len()-(self->Len()%2))>>1;
|
||||
unsigned short *t = (unsigned short *)self->GetBuf();
|
||||
for(SQInteger i = 0; i < num; i++) {
|
||||
__swap_word(&t[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SQInteger _blob__set(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_BLOB(v);
|
||||
SQInteger idx,val;
|
||||
sq_getinteger(v,2,&idx);
|
||||
sq_getinteger(v,3,&val);
|
||||
if(idx < 0 || idx >= self->Len())
|
||||
return sq_throwerror(v,_SC("index out of range"));
|
||||
((unsigned char *)self->GetBuf())[idx] = (unsigned char) val;
|
||||
sq_push(v,3);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _blob__get(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_BLOB(v);
|
||||
SQInteger idx;
|
||||
sq_getinteger(v,2,&idx);
|
||||
if(idx < 0 || idx >= self->Len())
|
||||
return sq_throwerror(v,_SC("index out of range"));
|
||||
sq_pushinteger(v,((unsigned char *)self->GetBuf())[idx]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _blob__nexti(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_BLOB(v);
|
||||
if(sq_gettype(v,2) == OT_NULL) {
|
||||
sq_pushinteger(v, 0);
|
||||
return 1;
|
||||
}
|
||||
SQInteger idx;
|
||||
if(SQ_SUCCEEDED(sq_getinteger(v, 2, &idx))) {
|
||||
if(idx+1 < self->Len()) {
|
||||
sq_pushinteger(v, idx+1);
|
||||
return 1;
|
||||
}
|
||||
sq_pushnull(v);
|
||||
return 1;
|
||||
}
|
||||
return sq_throwerror(v,_SC("internal error (_nexti) wrong argument type"));
|
||||
}
|
||||
|
||||
static SQInteger _blob__typeof(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushstring(v,_SC("blob"),-1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _blob_releasehook(SQUserPointer p, SQInteger size)
|
||||
{
|
||||
SQBlob *self = (SQBlob*)p;
|
||||
delete self;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _blob_constructor(HSQUIRRELVM v)
|
||||
{
|
||||
SQInteger nparam = sq_gettop(v);
|
||||
SQInteger size = 0;
|
||||
if(nparam == 2) {
|
||||
sq_getinteger(v, 2, &size);
|
||||
}
|
||||
if(size < 0) return sq_throwerror(v, _SC("cannot create blob with negative size"));
|
||||
SQBlob *b = new SQBlob(size);
|
||||
if(SQ_FAILED(sq_setinstanceup(v,1,b))) {
|
||||
delete b;
|
||||
return sq_throwerror(v, _SC("cannot create blob with negative size"));
|
||||
}
|
||||
sq_setreleasehook(v,1,_blob_releasehook);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define _DECL_BLOB_FUNC(name,nparams,typecheck) {_SC(#name),_blob_##name,nparams,typecheck}
|
||||
static SQRegFunction _blob_methods[] = {
|
||||
_DECL_BLOB_FUNC(constructor,-1,_SC("xn")),
|
||||
_DECL_BLOB_FUNC(resize,2,_SC("xn")),
|
||||
_DECL_BLOB_FUNC(swap2,1,_SC("x")),
|
||||
_DECL_BLOB_FUNC(swap4,1,_SC("x")),
|
||||
_DECL_BLOB_FUNC(_set,3,_SC("xnn")),
|
||||
_DECL_BLOB_FUNC(_get,2,_SC("xn")),
|
||||
_DECL_BLOB_FUNC(_typeof,1,_SC("x")),
|
||||
_DECL_BLOB_FUNC(_nexti,2,_SC("x")),
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
//GLOBAL FUNCTIONS
|
||||
|
||||
static SQInteger _g_blob_casti2f(HSQUIRRELVM v)
|
||||
{
|
||||
SQInteger i;
|
||||
sq_getinteger(v,2,&i);
|
||||
sq_pushfloat(v,*((SQFloat *)&i));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _g_blob_castf2i(HSQUIRRELVM v)
|
||||
{
|
||||
SQFloat f;
|
||||
sq_getfloat(v,2,&f);
|
||||
sq_pushinteger(v,*((SQInteger *)&f));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _g_blob_swap2(HSQUIRRELVM v)
|
||||
{
|
||||
SQInteger i;
|
||||
sq_getinteger(v,2,&i);
|
||||
short s=(short)i;
|
||||
sq_pushinteger(v,(s<<8)|((s>>8)&0x00FF));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _g_blob_swap4(HSQUIRRELVM v)
|
||||
{
|
||||
SQInteger i;
|
||||
sq_getinteger(v,2,&i);
|
||||
unsigned int t4 = (unsigned int)i;
|
||||
__swap_dword(&t4);
|
||||
sq_pushinteger(v,(SQInteger)t4);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _g_blob_swapfloat(HSQUIRRELVM v)
|
||||
{
|
||||
SQFloat f;
|
||||
sq_getfloat(v,2,&f);
|
||||
__swap_dword((unsigned int *)&f);
|
||||
sq_pushfloat(v,f);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define _DECL_GLOBALBLOB_FUNC(name,nparams,typecheck) {_SC(#name),_g_blob_##name,nparams,typecheck}
|
||||
static SQRegFunction bloblib_funcs[]={
|
||||
_DECL_GLOBALBLOB_FUNC(casti2f,2,_SC(".n")),
|
||||
_DECL_GLOBALBLOB_FUNC(castf2i,2,_SC(".n")),
|
||||
_DECL_GLOBALBLOB_FUNC(swap2,2,_SC(".n")),
|
||||
_DECL_GLOBALBLOB_FUNC(swap4,2,_SC(".n")),
|
||||
_DECL_GLOBALBLOB_FUNC(swapfloat,2,_SC(".n")),
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
SQRESULT sqstd_getblob(HSQUIRRELVM v,SQInteger idx,SQUserPointer *ptr)
|
||||
{
|
||||
SQBlob *blob;
|
||||
if(SQ_FAILED(sq_getinstanceup(v,idx,(SQUserPointer *)&blob,(SQUserPointer)SQSTD_BLOB_TYPE_TAG)))
|
||||
return -1;
|
||||
*ptr = blob->GetBuf();
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
SQInteger sqstd_getblobsize(HSQUIRRELVM v,SQInteger idx)
|
||||
{
|
||||
SQBlob *blob;
|
||||
if(SQ_FAILED(sq_getinstanceup(v,idx,(SQUserPointer *)&blob,(SQUserPointer)SQSTD_BLOB_TYPE_TAG)))
|
||||
return -1;
|
||||
return blob->Len();
|
||||
}
|
||||
|
||||
SQUserPointer sqstd_createblob(HSQUIRRELVM v, SQInteger size)
|
||||
{
|
||||
SQInteger top = sq_gettop(v);
|
||||
sq_pushregistrytable(v);
|
||||
sq_pushstring(v,_SC("std_blob"),-1);
|
||||
if(SQ_SUCCEEDED(sq_get(v,-2))) {
|
||||
sq_remove(v,-2); //removes the registry
|
||||
sq_push(v,1); // push the this
|
||||
sq_pushinteger(v,size); //size
|
||||
SQBlob *blob = NULL;
|
||||
if(SQ_SUCCEEDED(sq_call(v,2,SQTrue,SQFalse))
|
||||
&& SQ_SUCCEEDED(sq_getinstanceup(v,-1,(SQUserPointer *)&blob,(SQUserPointer)SQSTD_BLOB_TYPE_TAG))) {
|
||||
sq_remove(v,-2);
|
||||
return blob->GetBuf();
|
||||
}
|
||||
}
|
||||
sq_settop(v,top);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SQRESULT sqstd_register_bloblib(HSQUIRRELVM v)
|
||||
{
|
||||
return declare_stream(v,_SC("blob"),(SQUserPointer)SQSTD_BLOB_TYPE_TAG,_SC("std_blob"),_blob_methods,bloblib_funcs);
|
||||
}
|
||||
|
108
src/3rdparty/squirrel/sqstdlib/sqstdblobimpl.h
vendored
108
src/3rdparty/squirrel/sqstdlib/sqstdblobimpl.h
vendored
@@ -1,108 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
#ifndef _SQSTD_BLOBIMPL_H_
|
||||
#define _SQSTD_BLOBIMPL_H_
|
||||
|
||||
struct SQBlob : public SQStream
|
||||
{
|
||||
SQBlob(SQInteger size) {
|
||||
_size = size;
|
||||
_allocated = size;
|
||||
_buf = (unsigned char *)sq_malloc(size);
|
||||
memset(_buf, 0, _size);
|
||||
_ptr = 0;
|
||||
_owns = true;
|
||||
}
|
||||
virtual ~SQBlob() {
|
||||
sq_free(_buf, _allocated);
|
||||
}
|
||||
SQInteger Write(void *buffer, SQInteger size) {
|
||||
if(!CanAdvance(size)) {
|
||||
GrowBufOf(_ptr + size - _size);
|
||||
}
|
||||
memcpy(&_buf[_ptr], buffer, size);
|
||||
_ptr += size;
|
||||
return size;
|
||||
}
|
||||
SQInteger Read(void *buffer,SQInteger size) {
|
||||
SQInteger n = size;
|
||||
if(!CanAdvance(size)) {
|
||||
if((_size - _ptr) > 0)
|
||||
n = _size - _ptr;
|
||||
else return 0;
|
||||
}
|
||||
memcpy(buffer, &_buf[_ptr], n);
|
||||
_ptr += n;
|
||||
return n;
|
||||
}
|
||||
bool Resize(SQInteger n) {
|
||||
if(!_owns) return false;
|
||||
if(n != _allocated) {
|
||||
unsigned char *newbuf = (unsigned char *)sq_malloc(n);
|
||||
memset(newbuf,0,n);
|
||||
if(_size > n)
|
||||
memcpy(newbuf,_buf,n);
|
||||
else
|
||||
memcpy(newbuf,_buf,_size);
|
||||
sq_free(_buf,_allocated);
|
||||
_buf=newbuf;
|
||||
_allocated = n;
|
||||
if(_size > _allocated)
|
||||
_size = _allocated;
|
||||
if(_ptr > _allocated)
|
||||
_ptr = _allocated;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
bool GrowBufOf(SQInteger n)
|
||||
{
|
||||
bool ret = true;
|
||||
if(_size + n > _allocated) {
|
||||
if(_size + n > _size * 2)
|
||||
ret = Resize(_size + n);
|
||||
else
|
||||
ret = Resize(_size * 2);
|
||||
}
|
||||
_size = _size + n;
|
||||
return ret;
|
||||
}
|
||||
bool CanAdvance(SQInteger n) {
|
||||
if(_ptr+n>_size)return false;
|
||||
return true;
|
||||
}
|
||||
SQInteger Seek(SQInteger offset, SQInteger origin) {
|
||||
switch(origin) {
|
||||
case SQ_SEEK_SET:
|
||||
if(offset > _size || offset < 0) return -1;
|
||||
_ptr = offset;
|
||||
break;
|
||||
case SQ_SEEK_CUR:
|
||||
if(_ptr + offset > _size || _ptr + offset < 0) return -1;
|
||||
_ptr += offset;
|
||||
break;
|
||||
case SQ_SEEK_END:
|
||||
if(_size + offset > _size || _size + offset < 0) return -1;
|
||||
_ptr = _size + offset;
|
||||
break;
|
||||
default: return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
bool IsValid() {
|
||||
return _buf?true:false;
|
||||
}
|
||||
bool EOS() {
|
||||
return _ptr == _size;
|
||||
}
|
||||
SQInteger Flush() { return 0; }
|
||||
SQInteger Tell() { return _ptr; }
|
||||
SQInteger Len() { return _size; }
|
||||
SQUserPointer GetBuf(){ return _buf; }
|
||||
private:
|
||||
SQInteger _size;
|
||||
SQInteger _allocated;
|
||||
SQInteger _ptr;
|
||||
unsigned char *_buf;
|
||||
bool _owns;
|
||||
};
|
||||
|
||||
#endif //_SQSTD_BLOBIMPL_H_
|
410
src/3rdparty/squirrel/sqstdlib/sqstdio.cpp
vendored
410
src/3rdparty/squirrel/sqstdlib/sqstdio.cpp
vendored
@@ -1,410 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
#include <stdio.h>
|
||||
#include <squirrel.h>
|
||||
#include <new>
|
||||
#include <sqstdio.h>
|
||||
#include "sqstdstream.h"
|
||||
|
||||
#define SQSTD_FILE_TYPE_TAG (SQSTD_STREAM_TYPE_TAG | 0x00000001)
|
||||
//basic API
|
||||
SQFILE sqstd_fopen(const SQChar *filename ,const SQChar *mode)
|
||||
{
|
||||
#ifndef SQUNICODE
|
||||
return (SQFILE)fopen(filename,mode);
|
||||
#else
|
||||
return (SQFILE)_wfopen(filename,mode);
|
||||
#endif
|
||||
}
|
||||
|
||||
SQInteger sqstd_fread(void* buffer, SQInteger size, SQInteger count, SQFILE file)
|
||||
{
|
||||
return (SQInteger)fread(buffer,size,count,(FILE *)file);
|
||||
}
|
||||
|
||||
SQInteger sqstd_fwrite(const SQUserPointer buffer, SQInteger size, SQInteger count, SQFILE file)
|
||||
{
|
||||
return (SQInteger)fwrite(buffer,size,count,(FILE *)file);
|
||||
}
|
||||
|
||||
SQInteger sqstd_fseek(SQFILE file, SQInteger offset, SQInteger origin)
|
||||
{
|
||||
SQInteger realorigin;
|
||||
switch(origin) {
|
||||
case SQ_SEEK_CUR: realorigin = SEEK_CUR; break;
|
||||
case SQ_SEEK_END: realorigin = SEEK_END; break;
|
||||
case SQ_SEEK_SET: realorigin = SEEK_SET; break;
|
||||
default: return -1; //failed
|
||||
}
|
||||
return fseek((FILE *)file,(long)offset,(int)realorigin);
|
||||
}
|
||||
|
||||
SQInteger sqstd_ftell(SQFILE file)
|
||||
{
|
||||
return ftell((FILE *)file);
|
||||
}
|
||||
|
||||
SQInteger sqstd_fflush(SQFILE file)
|
||||
{
|
||||
return fflush((FILE *)file);
|
||||
}
|
||||
|
||||
SQInteger sqstd_fclose(SQFILE file)
|
||||
{
|
||||
return fclose((FILE *)file);
|
||||
}
|
||||
|
||||
SQInteger sqstd_feof(SQFILE file)
|
||||
{
|
||||
return feof((FILE *)file);
|
||||
}
|
||||
|
||||
//File
|
||||
struct SQFile : public SQStream {
|
||||
SQFile() { _handle = NULL; _owns = false;}
|
||||
SQFile(SQFILE file, bool owns) { _handle = file; _owns = owns;}
|
||||
virtual ~SQFile() { Close(); }
|
||||
bool Open(const SQChar *filename ,const SQChar *mode) {
|
||||
Close();
|
||||
if( (_handle = sqstd_fopen(filename,mode)) ) {
|
||||
_owns = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void Close() {
|
||||
if(_handle && _owns) {
|
||||
sqstd_fclose(_handle);
|
||||
_handle = NULL;
|
||||
_owns = false;
|
||||
}
|
||||
}
|
||||
SQInteger Read(void *buffer,SQInteger size) {
|
||||
return sqstd_fread(buffer,1,size,_handle);
|
||||
}
|
||||
SQInteger Write(void *buffer,SQInteger size) {
|
||||
return sqstd_fwrite(buffer,1,size,_handle);
|
||||
}
|
||||
SQInteger Flush() {
|
||||
return sqstd_fflush(_handle);
|
||||
}
|
||||
SQInteger Tell() {
|
||||
return sqstd_ftell(_handle);
|
||||
}
|
||||
SQInteger Len() {
|
||||
SQInteger prevpos=Tell();
|
||||
Seek(0,SQ_SEEK_END);
|
||||
SQInteger size=Tell();
|
||||
Seek(prevpos,SQ_SEEK_SET);
|
||||
return size;
|
||||
}
|
||||
SQInteger Seek(SQInteger offset, SQInteger origin) {
|
||||
return sqstd_fseek(_handle,offset,origin);
|
||||
}
|
||||
bool IsValid() { return _handle?true:false; }
|
||||
bool EOS() { return Tell()==Len()?true:false;}
|
||||
SQFILE GetHandle() {return _handle;}
|
||||
private:
|
||||
SQFILE _handle;
|
||||
bool _owns;
|
||||
};
|
||||
|
||||
static SQInteger _file__typeof(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushstring(v,_SC("file"),-1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _file_releasehook(SQUserPointer p, SQInteger size)
|
||||
{
|
||||
SQFile *self = (SQFile*)p;
|
||||
delete self;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _file_constructor(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar *filename,*mode;
|
||||
bool owns = true;
|
||||
SQFile *f;
|
||||
SQFILE newf;
|
||||
if(sq_gettype(v,2) == OT_STRING && sq_gettype(v,3) == OT_STRING) {
|
||||
sq_getstring(v, 2, &filename);
|
||||
sq_getstring(v, 3, &mode);
|
||||
newf = sqstd_fopen(filename, mode);
|
||||
if(!newf) return sq_throwerror(v, _SC("cannot open file"));
|
||||
} else if(sq_gettype(v,2) == OT_USERPOINTER) {
|
||||
owns = !(sq_gettype(v,3) == OT_NULL);
|
||||
sq_getuserpointer(v,2,&newf);
|
||||
} else {
|
||||
return sq_throwerror(v,_SC("wrong parameter"));
|
||||
}
|
||||
f = new SQFile(newf,owns);
|
||||
if(SQ_FAILED(sq_setinstanceup(v,1,f))) {
|
||||
delete f;
|
||||
return sq_throwerror(v, _SC("cannot create blob with negative size"));
|
||||
}
|
||||
sq_setreleasehook(v,1,_file_releasehook);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//bindings
|
||||
#define _DECL_FILE_FUNC(name,nparams,typecheck) {_SC(#name),_file_##name,nparams,typecheck}
|
||||
static SQRegFunction _file_methods[] = {
|
||||
_DECL_FILE_FUNC(constructor,3,_SC("x")),
|
||||
_DECL_FILE_FUNC(_typeof,1,_SC("x")),
|
||||
{0,0,0,0},
|
||||
};
|
||||
|
||||
|
||||
|
||||
SQRESULT sqstd_createfile(HSQUIRRELVM v, SQFILE file,SQBool own)
|
||||
{
|
||||
SQInteger top = sq_gettop(v);
|
||||
sq_pushregistrytable(v);
|
||||
sq_pushstring(v,_SC("std_file"),-1);
|
||||
if(SQ_SUCCEEDED(sq_get(v,-2))) {
|
||||
sq_remove(v,-2); //removes the registry
|
||||
sq_pushroottable(v); // push the this
|
||||
sq_pushuserpointer(v,file); //file
|
||||
if(own){
|
||||
sq_pushinteger(v,1); //true
|
||||
}
|
||||
else{
|
||||
sq_pushnull(v); //false
|
||||
}
|
||||
if(SQ_SUCCEEDED( sq_call(v,3,SQTrue,SQFalse) )) {
|
||||
sq_remove(v,-2);
|
||||
return SQ_OK;
|
||||
}
|
||||
}
|
||||
sq_settop(v,top);
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
SQRESULT sqstd_getfile(HSQUIRRELVM v, SQInteger idx, SQFILE *file)
|
||||
{
|
||||
SQFile *fileobj = NULL;
|
||||
if(SQ_SUCCEEDED(sq_getinstanceup(v,idx,(SQUserPointer*)&fileobj,(SQUserPointer)SQSTD_FILE_TYPE_TAG))) {
|
||||
*file = fileobj->GetHandle();
|
||||
return SQ_OK;
|
||||
}
|
||||
return sq_throwerror(v,_SC("not a file"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
static SQInteger _io_file_lexfeed_ASCII(SQUserPointer file)
|
||||
{
|
||||
SQInteger ret;
|
||||
char c;
|
||||
if( ( ret=sqstd_fread(&c,sizeof(c),1,(FILE *)file )>0) )
|
||||
return c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SQInteger _io_file_lexfeed_UTF8(SQUserPointer file)
|
||||
{
|
||||
#define READ() \
|
||||
if(sqstd_fread(&inchar,sizeof(inchar),1,(FILE *)file) != 1) \
|
||||
return 0;
|
||||
|
||||
static const SQInteger utf8_lengths[16] =
|
||||
{
|
||||
1,1,1,1,1,1,1,1, /* 0000 to 0111 : 1 byte (plain ASCII) */
|
||||
0,0,0,0, /* 1000 to 1011 : not valid */
|
||||
2,2, /* 1100, 1101 : 2 bytes */
|
||||
3, /* 1110 : 3 bytes */
|
||||
4 /* 1111 :4 bytes */
|
||||
};
|
||||
static unsigned char byte_masks[5] = {0,0,0x1f,0x0f,0x07};
|
||||
unsigned char inchar;
|
||||
SQInteger c = 0;
|
||||
READ();
|
||||
c = inchar;
|
||||
//
|
||||
if(c >= 0x80) {
|
||||
SQInteger tmp;
|
||||
SQInteger codelen = utf8_lengths[c>>4];
|
||||
if(codelen == 0)
|
||||
return 0;
|
||||
//"invalid UTF-8 stream";
|
||||
tmp = c&byte_masks[codelen];
|
||||
for(SQInteger n = 0; n < codelen-1; n++) {
|
||||
tmp<<=6;
|
||||
READ();
|
||||
tmp |= inchar & 0x3F;
|
||||
}
|
||||
c = tmp;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
static SQInteger _io_file_lexfeed_UCS2_LE(SQUserPointer file)
|
||||
{
|
||||
SQInteger ret;
|
||||
wchar_t c;
|
||||
if( ( ret=sqstd_fread(&c,sizeof(c),1,(FILE *)file )>0) )
|
||||
return (SQChar)c;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SQInteger _io_file_lexfeed_UCS2_BE(SQUserPointer file)
|
||||
{
|
||||
SQInteger ret;
|
||||
unsigned short c;
|
||||
if( ( ret=sqstd_fread(&c,sizeof(c),1,(FILE *)file )>0) ) {
|
||||
c = ((c>>8)&0x00FF)| ((c<<8)&0xFF00);
|
||||
return (SQChar)c;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
SQInteger file_read(SQUserPointer file,SQUserPointer buf,SQInteger size)
|
||||
{
|
||||
SQInteger ret;
|
||||
if( ( ret = sqstd_fread(buf,1,size,(SQFILE)file ))!=0 )return ret;
|
||||
return -1;
|
||||
}
|
||||
|
||||
SQInteger file_write(SQUserPointer file,SQUserPointer p,SQInteger size)
|
||||
{
|
||||
return sqstd_fwrite(p,1,size,(SQFILE)file);
|
||||
}
|
||||
|
||||
SQRESULT sqstd_loadfile(HSQUIRRELVM v,const SQChar *filename,SQBool printerror)
|
||||
{
|
||||
SQFILE file = sqstd_fopen(filename,_SC("rb"));
|
||||
SQInteger ret;
|
||||
unsigned short us;
|
||||
unsigned char uc;
|
||||
SQLEXREADFUNC func = _io_file_lexfeed_ASCII;
|
||||
if(file){
|
||||
ret = sqstd_fread(&us,1,2,file);
|
||||
if(ret != 2) {
|
||||
//probably an empty file
|
||||
us = 0;
|
||||
}
|
||||
if(us == SQ_BYTECODE_STREAM_TAG) { //BYTECODE
|
||||
sqstd_fseek(file,0,SQ_SEEK_SET);
|
||||
if(SQ_SUCCEEDED(sq_readclosure(v,file_read,file))) {
|
||||
sqstd_fclose(file);
|
||||
return SQ_OK;
|
||||
}
|
||||
}
|
||||
else { //SCRIPT
|
||||
switch(us)
|
||||
{
|
||||
//gotta swap the next 2 lines on BIG endian machines
|
||||
case 0xFFFE: func = _io_file_lexfeed_UCS2_BE; break;//UTF-16 little endian;
|
||||
case 0xFEFF: func = _io_file_lexfeed_UCS2_LE; break;//UTF-16 big endian;
|
||||
case 0xBBEF:
|
||||
if(sqstd_fread(&uc,1,sizeof(uc),file) == 0) {
|
||||
sqstd_fclose(file);
|
||||
return sq_throwerror(v,_SC("io error"));
|
||||
}
|
||||
if(uc != 0xBF) {
|
||||
sqstd_fclose(file);
|
||||
return sq_throwerror(v,_SC("Unrecognozed ecoding"));
|
||||
}
|
||||
func = _io_file_lexfeed_UTF8;
|
||||
break;//UTF-8 ;
|
||||
default: sqstd_fseek(file,0,SQ_SEEK_SET); break; // ascii
|
||||
}
|
||||
|
||||
if(SQ_SUCCEEDED(sq_compile(v,func,file,filename,printerror))){
|
||||
sqstd_fclose(file);
|
||||
return SQ_OK;
|
||||
}
|
||||
}
|
||||
sqstd_fclose(file);
|
||||
return SQ_ERROR;
|
||||
}
|
||||
return sq_throwerror(v,_SC("cannot open the file"));
|
||||
}
|
||||
|
||||
SQRESULT sqstd_dofile(HSQUIRRELVM v,const SQChar *filename,SQBool retval,SQBool printerror)
|
||||
{
|
||||
if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,printerror))) {
|
||||
sq_push(v,-2);
|
||||
if(SQ_SUCCEEDED(sq_call(v,1,retval,SQTrue))) {
|
||||
sq_remove(v,retval?-2:-1); //removes the closure
|
||||
return 1;
|
||||
}
|
||||
sq_pop(v,1); //removes the closure
|
||||
}
|
||||
return SQ_ERROR;
|
||||
}
|
||||
|
||||
SQRESULT sqstd_writeclosuretofile(HSQUIRRELVM v,const SQChar *filename)
|
||||
{
|
||||
SQFILE file = sqstd_fopen(filename,_SC("wb+"));
|
||||
if(!file) return sq_throwerror(v,_SC("cannot open the file"));
|
||||
if(SQ_SUCCEEDED(sq_writeclosure(v,file_write,file))) {
|
||||
sqstd_fclose(file);
|
||||
return SQ_OK;
|
||||
}
|
||||
sqstd_fclose(file);
|
||||
return SQ_ERROR; //forward the error
|
||||
}
|
||||
|
||||
SQInteger _g_io_loadfile(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar *filename;
|
||||
SQBool printerror = SQFalse;
|
||||
sq_getstring(v,2,&filename);
|
||||
if(sq_gettop(v) >= 3) {
|
||||
sq_getbool(v,3,&printerror);
|
||||
}
|
||||
if(SQ_SUCCEEDED(sqstd_loadfile(v,filename,printerror)))
|
||||
return 1;
|
||||
return SQ_ERROR; //propagates the error
|
||||
}
|
||||
|
||||
SQInteger _g_io_writeclosuretofile(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar *filename;
|
||||
sq_getstring(v,2,&filename);
|
||||
if(SQ_SUCCEEDED(sqstd_writeclosuretofile(v,filename)))
|
||||
return 1;
|
||||
return SQ_ERROR; //propagates the error
|
||||
}
|
||||
|
||||
SQInteger _g_io_dofile(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar *filename;
|
||||
SQBool printerror = SQFalse;
|
||||
sq_getstring(v,2,&filename);
|
||||
if(sq_gettop(v) >= 3) {
|
||||
sq_getbool(v,3,&printerror);
|
||||
}
|
||||
sq_push(v,1); //repush the this
|
||||
if(SQ_SUCCEEDED(sqstd_dofile(v,filename,SQTrue,printerror)))
|
||||
return 1;
|
||||
return SQ_ERROR; //propagates the error
|
||||
}
|
||||
|
||||
#define _DECL_GLOBALIO_FUNC(name,nparams,typecheck) {_SC(#name),_g_io_##name,nparams,typecheck}
|
||||
static SQRegFunction iolib_funcs[]={
|
||||
_DECL_GLOBALIO_FUNC(loadfile,-2,_SC(".sb")),
|
||||
_DECL_GLOBALIO_FUNC(dofile,-2,_SC(".sb")),
|
||||
_DECL_GLOBALIO_FUNC(writeclosuretofile,3,_SC(".sc")),
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
SQRESULT sqstd_register_iolib(HSQUIRRELVM v)
|
||||
{
|
||||
SQInteger top = sq_gettop(v);
|
||||
//create delegate
|
||||
declare_stream(v,_SC("file"),(SQUserPointer)SQSTD_FILE_TYPE_TAG,_SC("std_file"),_file_methods,iolib_funcs);
|
||||
sq_pushstring(v,_SC("stdout"),-1);
|
||||
sqstd_createfile(v,stdout,SQFalse);
|
||||
sq_createslot(v,-3);
|
||||
sq_pushstring(v,_SC("stdin"),-1);
|
||||
sqstd_createfile(v,stdin,SQFalse);
|
||||
sq_createslot(v,-3);
|
||||
sq_pushstring(v,_SC("stderr"),-1);
|
||||
sqstd_createfile(v,stderr,SQFalse);
|
||||
sq_createslot(v,-3);
|
||||
sq_settop(v,top);
|
||||
return SQ_OK;
|
||||
}
|
131
src/3rdparty/squirrel/sqstdlib/sqstdlib.dsp
vendored
131
src/3rdparty/squirrel/sqstdlib/sqstdlib.dsp
vendored
@@ -1,131 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="sqstdlib" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=sqstdlib - Win32 Release
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "sqstdlib.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "sqstdlib.mak" CFG="sqstdlib - Win32 Release"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "sqstdlib - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "sqstdlib - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_LocalPath ".."
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "sqstdlib - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
||||
# ADD RSC /l 0x410 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\lib\sqstdlib.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "sqstdlib - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x410 /d "_DEBUG"
|
||||
# ADD RSC /l 0x410 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\lib\sqstdlib.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "sqstdlib - Win32 Release"
|
||||
# Name "sqstdlib - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdblob.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdio.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdmath.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdrex.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdstream.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdstring.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdaux.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdsystem.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdblobimpl.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstdstream.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
330
src/3rdparty/squirrel/sqstdlib/sqstdstream.cpp
vendored
330
src/3rdparty/squirrel/sqstdlib/sqstdstream.cpp
vendored
@@ -1,330 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
#include <stdio.h>
|
||||
#include <new>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <squirrel.h>
|
||||
#include <sqstdio.h>
|
||||
#include <sqstdblob.h>
|
||||
#include "sqstdstream.h"
|
||||
#include "sqstdblobimpl.h"
|
||||
|
||||
#define SETUP_STREAM(v) \
|
||||
SQStream *self = NULL; \
|
||||
if(SQ_FAILED(sq_getinstanceup(v,1,(SQUserPointer*)&self,(SQUserPointer)SQSTD_STREAM_TYPE_TAG))) \
|
||||
return sq_throwerror(v,_SC("invalid type tag")); \
|
||||
if(!self->IsValid()) \
|
||||
return sq_throwerror(v,_SC("the stream is invalid"));
|
||||
|
||||
SQInteger _stream_readblob(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_STREAM(v);
|
||||
SQUserPointer data,blobp;
|
||||
SQInteger size,res;
|
||||
sq_getinteger(v,2,&size);
|
||||
if(size > self->Len()) {
|
||||
size = self->Len();
|
||||
}
|
||||
data = sq_getscratchpad(v,size);
|
||||
res = self->Read(data,size);
|
||||
if(res <= 0)
|
||||
return sq_throwerror(v,_SC("no data left to read"));
|
||||
blobp = sqstd_createblob(v,res);
|
||||
memcpy(blobp,data,res);
|
||||
return 1;
|
||||
}
|
||||
|
||||
#define SAFE_READN(ptr,len) { \
|
||||
if(self->Read(ptr,len) != len) return sq_throwerror(v,_SC("io error")); \
|
||||
}
|
||||
SQInteger _stream_readn(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_STREAM(v);
|
||||
SQInteger format;
|
||||
sq_getinteger(v, 2, &format);
|
||||
switch(format) {
|
||||
case 'l': {
|
||||
SQInteger i;
|
||||
SAFE_READN(&i, sizeof(i));
|
||||
sq_pushinteger(v, i);
|
||||
}
|
||||
break;
|
||||
case 'i': {
|
||||
SQInt32 i;
|
||||
SAFE_READN(&i, sizeof(i));
|
||||
sq_pushinteger(v, i);
|
||||
}
|
||||
break;
|
||||
case 's': {
|
||||
short s;
|
||||
SAFE_READN(&s, sizeof(short));
|
||||
sq_pushinteger(v, s);
|
||||
}
|
||||
break;
|
||||
case 'w': {
|
||||
unsigned short w;
|
||||
SAFE_READN(&w, sizeof(unsigned short));
|
||||
sq_pushinteger(v, w);
|
||||
}
|
||||
break;
|
||||
case 'c': {
|
||||
char c;
|
||||
SAFE_READN(&c, sizeof(char));
|
||||
sq_pushinteger(v, c);
|
||||
}
|
||||
break;
|
||||
case 'b': {
|
||||
unsigned char c;
|
||||
SAFE_READN(&c, sizeof(unsigned char));
|
||||
sq_pushinteger(v, c);
|
||||
}
|
||||
break;
|
||||
case 'f': {
|
||||
float f;
|
||||
SAFE_READN(&f, sizeof(float));
|
||||
sq_pushfloat(v, f);
|
||||
}
|
||||
break;
|
||||
case 'd': {
|
||||
double d;
|
||||
SAFE_READN(&d, sizeof(double));
|
||||
sq_pushfloat(v, (SQFloat)d);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return sq_throwerror(v, _SC("invalid format"));
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
SQInteger _stream_writeblob(HSQUIRRELVM v)
|
||||
{
|
||||
SQUserPointer data;
|
||||
SQInteger size;
|
||||
SETUP_STREAM(v);
|
||||
if(SQ_FAILED(sqstd_getblob(v,2,&data)))
|
||||
return sq_throwerror(v,_SC("invalid parameter"));
|
||||
size = sqstd_getblobsize(v,2);
|
||||
if(self->Write(data,size) != size)
|
||||
return sq_throwerror(v,_SC("io error"));
|
||||
sq_pushinteger(v,size);
|
||||
return 1;
|
||||
}
|
||||
|
||||
SQInteger _stream_writen(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_STREAM(v);
|
||||
SQInteger format, ti;
|
||||
SQFloat tf;
|
||||
sq_getinteger(v, 3, &format);
|
||||
switch(format) {
|
||||
case 'l': {
|
||||
SQInteger i;
|
||||
sq_getinteger(v, 2, &ti);
|
||||
i = ti;
|
||||
self->Write(&i, sizeof(SQInteger));
|
||||
}
|
||||
break;
|
||||
case 'i': {
|
||||
SQInt32 i;
|
||||
sq_getinteger(v, 2, &ti);
|
||||
i = (SQInt32)ti;
|
||||
self->Write(&i, sizeof(SQInt32));
|
||||
}
|
||||
break;
|
||||
case 's': {
|
||||
short s;
|
||||
sq_getinteger(v, 2, &ti);
|
||||
s = (short)ti;
|
||||
self->Write(&s, sizeof(short));
|
||||
}
|
||||
break;
|
||||
case 'w': {
|
||||
unsigned short w;
|
||||
sq_getinteger(v, 2, &ti);
|
||||
w = (unsigned short)ti;
|
||||
self->Write(&w, sizeof(unsigned short));
|
||||
}
|
||||
break;
|
||||
case 'c': {
|
||||
char c;
|
||||
sq_getinteger(v, 2, &ti);
|
||||
c = (char)ti;
|
||||
self->Write(&c, sizeof(char));
|
||||
}
|
||||
break;
|
||||
case 'b': {
|
||||
unsigned char b;
|
||||
sq_getinteger(v, 2, &ti);
|
||||
b = (unsigned char)ti;
|
||||
self->Write(&b, sizeof(unsigned char));
|
||||
}
|
||||
break;
|
||||
case 'f': {
|
||||
float f;
|
||||
sq_getfloat(v, 2, &tf);
|
||||
f = (float)tf;
|
||||
self->Write(&f, sizeof(float));
|
||||
}
|
||||
break;
|
||||
case 'd': {
|
||||
double d;
|
||||
sq_getfloat(v, 2, &tf);
|
||||
d = tf;
|
||||
self->Write(&d, sizeof(double));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return sq_throwerror(v, _SC("invalid format"));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
SQInteger _stream_seek(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_STREAM(v);
|
||||
SQInteger offset, origin = SQ_SEEK_SET;
|
||||
sq_getinteger(v, 2, &offset);
|
||||
if(sq_gettop(v) > 2) {
|
||||
SQInteger t;
|
||||
sq_getinteger(v, 3, &t);
|
||||
switch(t) {
|
||||
case 'b': origin = SQ_SEEK_SET; break;
|
||||
case 'c': origin = SQ_SEEK_CUR; break;
|
||||
case 'e': origin = SQ_SEEK_END; break;
|
||||
default: return sq_throwerror(v,_SC("invalid origin"));
|
||||
}
|
||||
}
|
||||
sq_pushinteger(v, self->Seek(offset, origin));
|
||||
return 1;
|
||||
}
|
||||
|
||||
SQInteger _stream_tell(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_STREAM(v);
|
||||
sq_pushinteger(v, self->Tell());
|
||||
return 1;
|
||||
}
|
||||
|
||||
SQInteger _stream_len(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_STREAM(v);
|
||||
sq_pushinteger(v, self->Len());
|
||||
return 1;
|
||||
}
|
||||
|
||||
SQInteger _stream_flush(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_STREAM(v);
|
||||
if(!self->Flush())
|
||||
sq_pushinteger(v, 1);
|
||||
else
|
||||
sq_pushnull(v);
|
||||
return 1;
|
||||
}
|
||||
|
||||
SQInteger _stream_eos(HSQUIRRELVM v)
|
||||
{
|
||||
SETUP_STREAM(v);
|
||||
if(self->EOS())
|
||||
sq_pushinteger(v, 1);
|
||||
else
|
||||
sq_pushnull(v);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQRegFunction _stream_methods[] = {
|
||||
_DECL_STREAM_FUNC(readblob,2,_SC("xn")),
|
||||
_DECL_STREAM_FUNC(readn,2,_SC("xn")),
|
||||
_DECL_STREAM_FUNC(writeblob,-2,_SC("xx")),
|
||||
_DECL_STREAM_FUNC(writen,3,_SC("xnn")),
|
||||
_DECL_STREAM_FUNC(seek,-2,_SC("xnn")),
|
||||
_DECL_STREAM_FUNC(tell,1,_SC("x")),
|
||||
_DECL_STREAM_FUNC(len,1,_SC("x")),
|
||||
_DECL_STREAM_FUNC(eos,1,_SC("x")),
|
||||
_DECL_STREAM_FUNC(flush,1,_SC("x")),
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
void init_streamclass(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushregistrytable(v);
|
||||
sq_pushstring(v,_SC("std_stream"),-1);
|
||||
if(SQ_FAILED(sq_get(v,-2))) {
|
||||
sq_pushstring(v,_SC("std_stream"),-1);
|
||||
sq_newclass(v,SQFalse);
|
||||
sq_settypetag(v,-1,(SQUserPointer)SQSTD_STREAM_TYPE_TAG);
|
||||
SQInteger i = 0;
|
||||
while(_stream_methods[i].name != 0) {
|
||||
SQRegFunction &f = _stream_methods[i];
|
||||
sq_pushstring(v,f.name,-1);
|
||||
sq_newclosure(v,f.f,0);
|
||||
sq_setparamscheck(v,f.nparamscheck,f.typemask);
|
||||
sq_createslot(v,-3);
|
||||
i++;
|
||||
}
|
||||
sq_createslot(v,-3);
|
||||
sq_pushroottable(v);
|
||||
sq_pushstring(v,_SC("stream"),-1);
|
||||
sq_pushstring(v,_SC("std_stream"),-1);
|
||||
sq_get(v,-4);
|
||||
sq_createslot(v,-3);
|
||||
sq_pop(v,1);
|
||||
}
|
||||
else {
|
||||
sq_pop(v,1); //result
|
||||
}
|
||||
sq_pop(v,1);
|
||||
}
|
||||
|
||||
SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,SQRegFunction *methods,SQRegFunction *globals)
|
||||
{
|
||||
if(sq_gettype(v,-1) != OT_TABLE)
|
||||
return sq_throwerror(v,_SC("table expected"));
|
||||
SQInteger top = sq_gettop(v);
|
||||
//create delegate
|
||||
init_streamclass(v);
|
||||
sq_pushregistrytable(v);
|
||||
sq_pushstring(v,reg_name,-1);
|
||||
sq_pushstring(v,_SC("std_stream"),-1);
|
||||
if(SQ_SUCCEEDED(sq_get(v,-3))) {
|
||||
sq_newclass(v,SQTrue);
|
||||
sq_settypetag(v,-1,typetag);
|
||||
SQInteger i = 0;
|
||||
while(methods[i].name != 0) {
|
||||
SQRegFunction &f = methods[i];
|
||||
sq_pushstring(v,f.name,-1);
|
||||
sq_newclosure(v,f.f,0);
|
||||
sq_setparamscheck(v,f.nparamscheck,f.typemask);
|
||||
sq_setnativeclosurename(v,-1,f.name);
|
||||
sq_createslot(v,-3);
|
||||
i++;
|
||||
}
|
||||
sq_createslot(v,-3);
|
||||
sq_pop(v,1);
|
||||
|
||||
i = 0;
|
||||
while(globals[i].name!=0)
|
||||
{
|
||||
SQRegFunction &f = globals[i];
|
||||
sq_pushstring(v,f.name,-1);
|
||||
sq_newclosure(v,f.f,0);
|
||||
sq_setparamscheck(v,f.nparamscheck,f.typemask);
|
||||
sq_setnativeclosurename(v,-1,f.name);
|
||||
sq_createslot(v,-3);
|
||||
i++;
|
||||
}
|
||||
//register the class in the target table
|
||||
sq_pushstring(v,name,-1);
|
||||
sq_pushregistrytable(v);
|
||||
sq_pushstring(v,reg_name,-1);
|
||||
sq_get(v,-2);
|
||||
sq_remove(v,-2);
|
||||
sq_createslot(v,-3);
|
||||
|
||||
sq_settop(v,top);
|
||||
return SQ_OK;
|
||||
}
|
||||
sq_settop(v,top);
|
||||
return SQ_ERROR;
|
||||
}
|
18
src/3rdparty/squirrel/sqstdlib/sqstdstream.h
vendored
18
src/3rdparty/squirrel/sqstdlib/sqstdstream.h
vendored
@@ -1,18 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
#ifndef _SQSTD_STREAM_H_
|
||||
#define _SQSTD_STREAM_H_
|
||||
|
||||
SQInteger _stream_readblob(HSQUIRRELVM v);
|
||||
SQInteger _stream_readline(HSQUIRRELVM v);
|
||||
SQInteger _stream_readn(HSQUIRRELVM v);
|
||||
SQInteger _stream_writeblob(HSQUIRRELVM v);
|
||||
SQInteger _stream_writen(HSQUIRRELVM v);
|
||||
SQInteger _stream_seek(HSQUIRRELVM v);
|
||||
SQInteger _stream_tell(HSQUIRRELVM v);
|
||||
SQInteger _stream_len(HSQUIRRELVM v);
|
||||
SQInteger _stream_eos(HSQUIRRELVM v);
|
||||
SQInteger _stream_flush(HSQUIRRELVM v);
|
||||
|
||||
#define _DECL_STREAM_FUNC(name,nparams,typecheck) {_SC(#name),_stream_##name,nparams,typecheck}
|
||||
SQRESULT declare_stream(HSQUIRRELVM v,const SQChar* name,SQUserPointer typetag,const SQChar* reg_name,SQRegFunction *methods,SQRegFunction *globals);
|
||||
#endif /*_SQSTD_STREAM_H_*/
|
147
src/3rdparty/squirrel/sqstdlib/sqstdsystem.cpp
vendored
147
src/3rdparty/squirrel/sqstdlib/sqstdsystem.cpp
vendored
@@ -1,147 +0,0 @@
|
||||
/* see copyright notice in squirrel.h */
|
||||
#include <squirrel.h>
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <sqstdsystem.h>
|
||||
|
||||
#ifdef SQUNICODE
|
||||
#include <wchar.h>
|
||||
#define scgetenv _wgetenv
|
||||
#define scsystem _wsystem
|
||||
#define scasctime _wasctime
|
||||
#define scremove _wremove
|
||||
#define screname _wrename
|
||||
#else
|
||||
#define scgetenv getenv
|
||||
#define scsystem system
|
||||
#define scasctime asctime
|
||||
#define scremove remove
|
||||
#define screname rename
|
||||
#endif
|
||||
|
||||
static SQInteger _system_getenv(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar *s;
|
||||
if(SQ_SUCCEEDED(sq_getstring(v,2,&s))){
|
||||
sq_pushstring(v,scgetenv(s),-1);
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static SQInteger _system_system(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar *s;
|
||||
if(SQ_SUCCEEDED(sq_getstring(v,2,&s))){
|
||||
sq_pushinteger(v,scsystem(s));
|
||||
return 1;
|
||||
}
|
||||
return sq_throwerror(v,_SC("wrong param"));
|
||||
}
|
||||
|
||||
|
||||
static SQInteger _system_clock(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushfloat(v,((SQFloat)clock())/(SQFloat)CLOCKS_PER_SEC);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _system_time(HSQUIRRELVM v)
|
||||
{
|
||||
time_t t;
|
||||
time(&t);
|
||||
sq_pushinteger(v,*((SQInteger *)&t));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static SQInteger _system_remove(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar *s;
|
||||
sq_getstring(v,2,&s);
|
||||
if(scremove(s)==-1)
|
||||
return sq_throwerror(v,_SC("remove() failed"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static SQInteger _system_rename(HSQUIRRELVM v)
|
||||
{
|
||||
const SQChar *oldn,*newn;
|
||||
sq_getstring(v,2,&oldn);
|
||||
sq_getstring(v,3,&newn);
|
||||
if(screname(oldn,newn)==-1)
|
||||
return sq_throwerror(v,_SC("rename() failed"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void _set_integer_slot(HSQUIRRELVM v,const SQChar *name,SQInteger val)
|
||||
{
|
||||
sq_pushstring(v,name,-1);
|
||||
sq_pushinteger(v,val);
|
||||
sq_rawset(v,-3);
|
||||
}
|
||||
|
||||
static SQInteger _system_date(HSQUIRRELVM v)
|
||||
{
|
||||
time_t t;
|
||||
SQInteger it;
|
||||
SQInteger format = 'l';
|
||||
if(sq_gettop(v) > 1) {
|
||||
sq_getinteger(v,2,&it);
|
||||
t = it;
|
||||
if(sq_gettop(v) > 2) {
|
||||
sq_getinteger(v,3,(SQInteger*)&format);
|
||||
}
|
||||
}
|
||||
else {
|
||||
time(&t);
|
||||
}
|
||||
tm *date;
|
||||
if(format == 'u')
|
||||
date = gmtime(&t);
|
||||
else
|
||||
date = localtime(&t);
|
||||
if(!date)
|
||||
return sq_throwerror(v,_SC("crt api failure"));
|
||||
sq_newtable(v);
|
||||
_set_integer_slot(v, _SC("sec"), date->tm_sec);
|
||||
_set_integer_slot(v, _SC("min"), date->tm_min);
|
||||
_set_integer_slot(v, _SC("hour"), date->tm_hour);
|
||||
_set_integer_slot(v, _SC("day"), date->tm_mday);
|
||||
_set_integer_slot(v, _SC("month"), date->tm_mon);
|
||||
_set_integer_slot(v, _SC("year"), date->tm_year+1900);
|
||||
_set_integer_slot(v, _SC("wday"), date->tm_wday);
|
||||
_set_integer_slot(v, _SC("yday"), date->tm_yday);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#define _DECL_FUNC(name,nparams,pmask) {_SC(#name),_system_##name,nparams,pmask}
|
||||
static SQRegFunction systemlib_funcs[]={
|
||||
_DECL_FUNC(getenv,2,_SC(".s")),
|
||||
_DECL_FUNC(system,2,_SC(".s")),
|
||||
_DECL_FUNC(clock,1,NULL),
|
||||
_DECL_FUNC(time,1,NULL),
|
||||
_DECL_FUNC(date,-1,_SC(".nn")),
|
||||
_DECL_FUNC(remove,2,_SC(".s")),
|
||||
_DECL_FUNC(rename,3,_SC(".ss")),
|
||||
{0,0,0,0}
|
||||
};
|
||||
|
||||
|
||||
SQInteger sqstd_register_systemlib(HSQUIRRELVM v)
|
||||
{
|
||||
SQInteger i=0;
|
||||
while(systemlib_funcs[i].name!=0)
|
||||
{
|
||||
sq_pushstring(v,systemlib_funcs[i].name,-1);
|
||||
sq_newclosure(v,systemlib_funcs[i].f,0);
|
||||
sq_setparamscheck(v,systemlib_funcs[i].nparamscheck,systemlib_funcs[i].typemask);
|
||||
sq_setnativeclosurename(v,-1,systemlib_funcs[i].name);
|
||||
sq_createslot(v,-3);
|
||||
i++;
|
||||
}
|
||||
return 1;
|
||||
}
|
77
src/3rdparty/squirrel/squirrel.dsw
vendored
77
src/3rdparty/squirrel/squirrel.dsw
vendored
@@ -1,77 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "sq"=.\sq\sq.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name sqlibs
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name squirrel
|
||||
End Project Dependency
|
||||
Begin Project Dependency
|
||||
Project_Dep_Name sqstdlib
|
||||
End Project Dependency
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "sqstdlib"=.\sqstdlib\sqstdlib.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/squirrel", HAAAAAAA
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "squirrel"=.\squirrel\squirrel.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/squirrel", HAAAAAAA
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
begin source code control
|
||||
"$/squirrel", HAAAAAAA
|
||||
.
|
||||
end source code control
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
52
src/3rdparty/squirrel/squirrel/Makefile
vendored
52
src/3rdparty/squirrel/squirrel/Makefile
vendored
@@ -1,52 +0,0 @@
|
||||
SQUIRREL= ..
|
||||
|
||||
|
||||
OUT= $(SQUIRREL)/lib/libsquirrel.a
|
||||
INCZ= -I$(SQUIRREL)/include -I. -Iinclude
|
||||
DEFS=
|
||||
LIB=
|
||||
|
||||
OBJS= \
|
||||
sqapi.o \
|
||||
sqbaselib.o \
|
||||
sqcompiler.o \
|
||||
sqdebug.o \
|
||||
sqlexer.o \
|
||||
sqobject.o \
|
||||
sqparser.o \
|
||||
sqstate.o \
|
||||
sqtable.o \
|
||||
sqvm.o \
|
||||
sqmem.o \
|
||||
sqclass.o
|
||||
|
||||
SRCS= \
|
||||
sqapi.cpp \
|
||||
sqbaselib.cpp \
|
||||
sqfuncstate.cpp \
|
||||
sqdebug.cpp \
|
||||
sqlexer.cpp \
|
||||
sqobject.cpp \
|
||||
sqcompiler.cpp \
|
||||
sqstate.cpp \
|
||||
sqtable.cpp \
|
||||
sqmem.cpp \
|
||||
sqvm.cpp \
|
||||
sqclass.cpp
|
||||
|
||||
|
||||
|
||||
sq32:
|
||||
gcc -O2 -fno-rtti -Wall -c $(SRCS) $(INCZ) $(DEFS)
|
||||
ar rc $(OUT) *.o
|
||||
|
||||
sqprof:
|
||||
gcc -O2 -pg -fno-rtti -pie -gstabs -g3 -Wall -c $(SRCS) $(INCZ) $(DEFS)
|
||||
ar rc $(OUT) *.o
|
||||
|
||||
sq64:
|
||||
gcc -O2 -D_SQ64 -fno-rtti -Wall -c $(SRCS) $(INCZ) $(DEFS)
|
||||
ar rc $(OUT) *.o
|
||||
|
||||
clean:
|
||||
rm -f $(OUT) $(SRCS:%.cpp=%.o)
|
@@ -66,7 +66,7 @@ public:
|
||||
static SQChar temp[256];
|
||||
va_list vl;
|
||||
va_start(vl, s);
|
||||
scvsprintf(temp, s, vl);
|
||||
scvsnprintf(temp, sizeof(temp), s, vl);
|
||||
va_end(vl);
|
||||
throw temp;
|
||||
}
|
||||
|
302
src/3rdparty/squirrel/squirrel/squirrel.dsp
vendored
302
src/3rdparty/squirrel/squirrel/squirrel.dsp
vendored
@@ -1,302 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="squirrel" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=squirrel - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "squirrel.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "squirrel.mak" CFG="squirrel - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "squirrel - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "squirrel - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_LocalPath ".."
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "GARBAGE_COLLECTOR" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x410 /d "NDEBUG"
|
||||
# ADD RSC /l 0x410 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\lib\squirrel.lib"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "GARBAGE_COLLECTOR" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x410 /d "_DEBUG"
|
||||
# ADD RSC /l 0x410 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo /out:"..\lib\squirrel.lib"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "squirrel - Win32 Release"
|
||||
# Name "squirrel - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqapi.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqbaselib.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqcompiler.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqdebug.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqfuncstate.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqlexer.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqmem.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqobject.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstate.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqtable.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqclass.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqvm.cpp
|
||||
|
||||
!IF "$(CFG)" == "squirrel - Win32 Release"
|
||||
|
||||
!ELSEIF "$(CFG)" == "squirrel - Win32 Debug"
|
||||
|
||||
# ADD CPP /YX"stdafx.h"
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqarray.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqclosure.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqcompiler.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqfuncproto.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqfuncstate.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqlexer.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqobject.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqopcodes.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqpcheader.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstate.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqstring.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqtable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\squserdata.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\squtils.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqclass.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\sqvm.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
@@ -853,7 +853,7 @@ struct AIConfigWindow : public Window {
|
||||
case WID_AIC_GAMELIST: {
|
||||
this->selected_slot = OWNER_DEITY;
|
||||
this->InvalidateData();
|
||||
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
|
||||
if (click_count > 1 && this->selected_slot != INVALID_COMPANY && _game_mode != GM_NORMAL) ShowAIListWindow((CompanyID)this->selected_slot);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -44,7 +44,7 @@ void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32
|
||||
{
|
||||
if (result.Failed()) return;
|
||||
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile);
|
||||
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
|
||||
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
|
||||
}
|
||||
|
||||
@@ -226,8 +226,27 @@ public:
|
||||
this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
|
||||
this->OnInvalidateData();
|
||||
|
||||
this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
|
||||
this->SelectFirstAvailableAirport(true);
|
||||
/* Ensure airport class is valid (changing NewGRFs). */
|
||||
_selected_airport_class = Clamp(_selected_airport_class, APC_BEGIN, (AirportClassID)(AirportClass::GetClassCount() - 1));
|
||||
const AirportClass *ac = AirportClass::Get(_selected_airport_class);
|
||||
this->vscroll->SetCount(ac->GetSpecCount());
|
||||
|
||||
/* Ensure the airport index is valid for this class (changing NewGRFs). */
|
||||
_selected_airport_index = Clamp(_selected_airport_index, -1, ac->GetSpecCount() - 1);
|
||||
|
||||
/* Only when no valid airport was selected, we want to select the first airport. */
|
||||
bool selectFirstAirport = true;
|
||||
if (_selected_airport_index != -1) {
|
||||
const AirportSpec *as = ac->GetSpec(_selected_airport_index);
|
||||
if (as->IsAvailable()) {
|
||||
/* Ensure the airport layout is valid. */
|
||||
_selected_airport_layout = Clamp(_selected_airport_layout, 0, as->num_table - 1);
|
||||
selectFirstAirport = false;
|
||||
this->UpdateSelectSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
|
||||
}
|
||||
|
||||
virtual ~BuildAirportWindow()
|
||||
|
@@ -160,6 +160,41 @@ CargoArray GetCapacityOfArticulatedParts(EngineID engine)
|
||||
return capacity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the default cargoes and refits of an articulated vehicle.
|
||||
* The refits are linked to a cargo rather than an articulated part to prevent a long list of parts.
|
||||
* @param engine Model to investigate.
|
||||
* @param[out] cargoes Total amount of units that can be transported, summed by cargo.
|
||||
* @param[out] refits Whether a (possibly partial) refit for each cargo is possible.
|
||||
*/
|
||||
void GetArticulatedVehicleCargoesAndRefits(EngineID engine, CargoArray *cargoes, uint32 *refits)
|
||||
{
|
||||
cargoes->Clear();
|
||||
*refits = 0;
|
||||
|
||||
const Engine *e = Engine::Get(engine);
|
||||
|
||||
CargoID cargo_type;
|
||||
uint16 cargo_capacity = GetVehicleDefaultCapacity(engine, &cargo_type);
|
||||
if (cargo_type < NUM_CARGO && cargo_capacity > 0) {
|
||||
(*cargoes)[cargo_type] += cargo_capacity;
|
||||
if (IsEngineRefittable(engine)) SetBit(*refits, cargo_type);
|
||||
}
|
||||
|
||||
if (!e->IsGroundVehicle() || !HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return;
|
||||
|
||||
for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
|
||||
EngineID artic_engine = GetNextArticulatedPart(i, engine);
|
||||
if (artic_engine == INVALID_ENGINE) break;
|
||||
|
||||
cargo_capacity = GetVehicleDefaultCapacity(artic_engine, &cargo_type);
|
||||
if (cargo_type < NUM_CARGO && cargo_capacity > 0) {
|
||||
(*cargoes)[cargo_type] += cargo_capacity;
|
||||
if (IsEngineRefittable(artic_engine)) SetBit(*refits, cargo_type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether any of the articulated parts is refittable
|
||||
* @param engine the first part
|
||||
|
@@ -160,7 +160,7 @@ static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chai
|
||||
}
|
||||
|
||||
/* Update train weight etc., the old vehicle will be sold anyway */
|
||||
if (part_of_chain && new_head->type == VEH_TRAIN) Train::From(new_head)->ConsistChanged(true);
|
||||
if (part_of_chain && new_head->type == VEH_TRAIN) Train::From(new_head)->ConsistChanged(CCF_LOADUNLOAD);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -276,10 +276,8 @@ public:
|
||||
}
|
||||
|
||||
case WID_RV_INFO_TAB: {
|
||||
SetDParam(0, STR_REPLACE_NOT_REPLACING);
|
||||
Dimension d = GetStringBoundingBox(STR_BLACK_STRING);
|
||||
SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED);
|
||||
d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
|
||||
Dimension d = GetStringBoundingBox(STR_REPLACE_NOT_REPLACING);
|
||||
d = maxdim(d, GetStringBoundingBox(STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED));
|
||||
d.width += WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT;
|
||||
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
|
||||
*size = maxdim(*size, d);
|
||||
@@ -351,20 +349,21 @@ public:
|
||||
switch (widget) {
|
||||
case WID_RV_INFO_TAB: {
|
||||
const Company *c = Company::Get(_local_company);
|
||||
StringID str;
|
||||
if (this->sel_engine[0] != INVALID_ENGINE) {
|
||||
if (!EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group)) {
|
||||
SetDParam(0, STR_REPLACE_NOT_REPLACING);
|
||||
str = STR_REPLACE_NOT_REPLACING;
|
||||
} else {
|
||||
bool when_old = false;
|
||||
EngineID e = EngineReplacementForCompany(c, this->sel_engine[0], this->sel_group, &when_old);
|
||||
SetDParam(0, when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME);
|
||||
SetDParam(1, e);
|
||||
str = when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME;
|
||||
SetDParam(0, e);
|
||||
}
|
||||
} else {
|
||||
SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED);
|
||||
str = STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED;
|
||||
}
|
||||
|
||||
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_BLACK_STRING, TC_FROMSTRING, SA_HOR_CENTER);
|
||||
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_BLACK, SA_HOR_CENTER);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -100,7 +100,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
|
||||
|
||||
/* Then find the MD5 checksum */
|
||||
item = md5s->GetItem(filename, false);
|
||||
if (item == NULL) {
|
||||
if (item == NULL || item->value == NULL) {
|
||||
DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename);
|
||||
return false;
|
||||
}
|
||||
|
@@ -133,6 +133,46 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
uint m = *src_n;
|
||||
if (m == 0) {
|
||||
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
|
||||
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
|
||||
*anim = 0;
|
||||
} else {
|
||||
uint r = remap[GB(m, 0, 8)];
|
||||
*anim = r | (m & 0xFF00);
|
||||
if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
|
||||
}
|
||||
anim++;
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
} else {
|
||||
do {
|
||||
uint m = *src_n;
|
||||
if (m == 0) {
|
||||
if (src_px->a != 0) {
|
||||
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
|
||||
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
|
||||
*anim = 0;
|
||||
}
|
||||
} else {
|
||||
uint r = remap[GB(m, 0, 8)];
|
||||
*anim = 0;
|
||||
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
|
||||
}
|
||||
anim++;
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
|
||||
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
|
||||
@@ -208,6 +248,7 @@ void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
|
||||
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
|
||||
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,7 +480,7 @@ void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
|
||||
}
|
||||
|
||||
/* Make sure the backend redraws the whole screen */
|
||||
_video_driver->MakeDirty(0, 0, _screen.width, _screen.height);
|
||||
VideoDriver::GetInstance()->MakeDirty(0, 0, _screen.width, _screen.height);
|
||||
}
|
||||
|
||||
Blitter::PaletteAnimation Blitter_32bppAnim::UsePaletteAnimation()
|
||||
|
@@ -15,8 +15,8 @@
|
||||
#include "32bpp_optimized.hpp"
|
||||
|
||||
/** The optimised 32 bpp blitter with palette animation. */
|
||||
class Blitter_32bppAnim FINAL : public Blitter_32bppOptimized {
|
||||
private:
|
||||
class Blitter_32bppAnim : public Blitter_32bppOptimized {
|
||||
protected:
|
||||
uint16 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
|
||||
int anim_buf_width; ///< The width of the animation buffer.
|
||||
int anim_buf_height; ///< The height of the animation buffer.
|
||||
@@ -56,10 +56,9 @@ public:
|
||||
};
|
||||
|
||||
/** Factory for the 32bpp blitter with animation. */
|
||||
class FBlitter_32bppAnim : public BlitterFactory<FBlitter_32bppAnim> {
|
||||
class FBlitter_32bppAnim : public BlitterFactory {
|
||||
public:
|
||||
/* virtual */ const char *GetName() { return "32bpp-anim"; }
|
||||
/* virtual */ const char *GetDescription() { return "32bpp Animation Blitter (palette animation)"; }
|
||||
FBlitter_32bppAnim() : BlitterFactory("32bpp-anim", "32bpp Animation Blitter (palette animation)") {}
|
||||
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppAnim(); }
|
||||
};
|
||||
|
||||
|
399
src/blitter/32bpp_anim_sse4.cpp
Normal file
399
src/blitter/32bpp_anim_sse4.cpp
Normal file
@@ -0,0 +1,399 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_sse4_anim.cpp Implementation of the SSE4 32 bpp blitter with animation support. */
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../video/video_driver.hpp"
|
||||
#include "../table/sprites.h"
|
||||
#include "32bpp_anim_sse4.hpp"
|
||||
#include "32bpp_sse_func.hpp"
|
||||
|
||||
/** Instantiation of the SSE4 32bpp blitter factory. */
|
||||
static FBlitter_32bppSSE4_Anim iFBlitter_32bppSSE4_Anim;
|
||||
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. It is templated to allow faster operation.
|
||||
*
|
||||
* @tparam mode blitter mode
|
||||
* @param bp further blitting parameters
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last, bool translucent, bool animated>
|
||||
inline void Blitter_32bppSSE4_Anim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||
{
|
||||
const byte * const remap = bp->remap;
|
||||
Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
|
||||
uint16 *anim_line = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
|
||||
int effective_width = bp->width;
|
||||
|
||||
/* Find where to start reading in the source sprite. */
|
||||
const Blitter_32bppSSE_Base::SpriteData * const sd = (const Blitter_32bppSSE_Base::SpriteData *) bp->sprite;
|
||||
const SpriteInfo * const si = &sd->infos[zoom];
|
||||
const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width;
|
||||
const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
|
||||
|
||||
if (read_mode != RM_WITH_MARGIN) {
|
||||
src_rgba_line += bp->skip_left;
|
||||
src_mv_line += bp->skip_left;
|
||||
}
|
||||
const MapValue *src_mv = src_mv_line;
|
||||
|
||||
/* Load these variables into register before loop. */
|
||||
const __m128i a_cm = ALPHA_CONTROL_MASK;
|
||||
const __m128i pack_low_cm = PACK_LOW_CONTROL_MASK;
|
||||
const __m128i tr_nom_base = TRANSPARENT_NOM_BASE;
|
||||
|
||||
for (int y = bp->height; y != 0; y--) {
|
||||
Colour *dst = dst_line;
|
||||
const Colour *src = src_rgba_line + META_LENGTH;
|
||||
if (mode != BM_TRANSPARENT) src_mv = src_mv_line;
|
||||
uint16 *anim = anim_line;
|
||||
|
||||
if (read_mode == RM_WITH_MARGIN) {
|
||||
assert(bt_last == BT_NONE); // or you must ensure block type is preserved
|
||||
anim += src_rgba_line[0].data;
|
||||
src += src_rgba_line[0].data;
|
||||
dst += src_rgba_line[0].data;
|
||||
if (mode != BM_TRANSPARENT) src_mv += src_rgba_line[0].data;
|
||||
const int width_diff = si->sprite_width - bp->width;
|
||||
effective_width = bp->width - (int) src_rgba_line[0].data;
|
||||
const int delta_diff = (int) src_rgba_line[1].data - width_diff;
|
||||
const int new_width = effective_width - delta_diff;
|
||||
effective_width = delta_diff > 0 ? new_width : effective_width;
|
||||
if (effective_width <= 0) goto next_line;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
default:
|
||||
if (!translucent) {
|
||||
for (uint x = (uint) effective_width; x > 0; x--) {
|
||||
if (src->a) {
|
||||
if (animated) {
|
||||
*anim = *(const uint16*) src_mv;
|
||||
*dst = (src_mv->m >= PALETTE_ANIM_START) ? AdjustBrightneSSE(this->LookupColourInPalette(src_mv->m), src_mv->v) : src->data;
|
||||
} else {
|
||||
*anim = 0;
|
||||
*dst = *src;
|
||||
}
|
||||
}
|
||||
if (animated) src_mv++;
|
||||
anim++;
|
||||
src++;
|
||||
dst++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (uint x = (uint) effective_width/2; x != 0; x--) {
|
||||
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
|
||||
|
||||
if (animated) {
|
||||
/* Remap colours. */
|
||||
const byte m0 = mvX2;
|
||||
if (m0 >= PALETTE_ANIM_START) {
|
||||
const Colour c0 = (this->LookupColourInPalette(m0).data & 0x00FFFFFF) | (src[0].data & 0xFF000000);
|
||||
InsertFirstUint32(AdjustBrightneSSE(c0, (byte) (mvX2 >> 8)).data, srcABCD);
|
||||
}
|
||||
const byte m1 = mvX2 >> 16;
|
||||
if (m1 >= PALETTE_ANIM_START) {
|
||||
const Colour c1 = (this->LookupColourInPalette(m1).data & 0x00FFFFFF) | (src[1].data & 0xFF000000);
|
||||
InsertSecondUint32(AdjustBrightneSSE(c1, (byte) (mvX2 >> 24)).data, srcABCD);
|
||||
}
|
||||
|
||||
/* Update anim buffer. */
|
||||
const byte a0 = src[0].a;
|
||||
const byte a1 = src[1].a;
|
||||
uint32 anim01 = 0;
|
||||
if (a0 == 255) {
|
||||
if (a1 == 255) {
|
||||
*(uint32*) anim = mvX2;
|
||||
goto bmno_full_opacity;
|
||||
}
|
||||
anim01 = (uint16) mvX2;
|
||||
} else if (a0 == 0) {
|
||||
if (a1 == 0) {
|
||||
goto bmno_full_transparency;
|
||||
} else {
|
||||
if (a1 == 255) anim[1] = (uint16) (mvX2 >> 16);
|
||||
goto bmno_alpha_blend;
|
||||
}
|
||||
}
|
||||
if (a1 > 0) {
|
||||
if (a1 == 255) anim01 |= mvX2 & 0xFFFF0000;
|
||||
*(uint32*) anim = anim01;
|
||||
} else {
|
||||
anim[0] = (uint16) anim01;
|
||||
}
|
||||
} else {
|
||||
if (src[0].a) anim[0] = 0;
|
||||
if (src[1].a) anim[1] = 0;
|
||||
}
|
||||
|
||||
/* Blend colours. */
|
||||
bmno_alpha_blend:
|
||||
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm);
|
||||
bmno_full_opacity:
|
||||
_mm_storel_epi64((__m128i *) dst, srcABCD);
|
||||
bmno_full_transparency:
|
||||
src_mv += 2;
|
||||
src += 2;
|
||||
anim += 2;
|
||||
dst += 2;
|
||||
}
|
||||
|
||||
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
|
||||
if (src->a == 0) {
|
||||
} else if (src->a == 255) {
|
||||
*anim = *(const uint16*) src_mv;
|
||||
*dst = (src_mv->m >= PALETTE_ANIM_START) ? AdjustBrightneSSE(LookupColourInPalette(src_mv->m), src_mv->v) : *src;
|
||||
} else {
|
||||
*anim = 0;
|
||||
__m128i srcABCD;
|
||||
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
|
||||
if (src_mv->m >= PALETTE_ANIM_START) {
|
||||
Colour colour = AdjustBrightneSSE(LookupColourInPalette(src_mv->m), src_mv->v);
|
||||
colour.a = src->a;
|
||||
srcABCD = _mm_cvtsi32_si128(colour.data);
|
||||
} else {
|
||||
srcABCD = _mm_cvtsi32_si128(src->data);
|
||||
}
|
||||
dst->data = _mm_cvtsi128_si32(AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_COLOUR_REMAP:
|
||||
for (uint x = (uint) effective_width / 2; x != 0; x--) {
|
||||
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
|
||||
|
||||
/* Remap colours. */
|
||||
const uint m0 = (byte) mvX2;
|
||||
const uint r0 = remap[m0];
|
||||
const uint m1 = (byte) (mvX2 >> 16);
|
||||
const uint r1 = remap[m1];
|
||||
if (mvX2 & 0x00FF00FF) {
|
||||
#define CMOV_REMAP(m_colour, m_colour_init, m_src, m_m) \
|
||||
/* Written so the compiler uses CMOV. */ \
|
||||
Colour m_colour = m_colour_init; \
|
||||
{ \
|
||||
const Colour srcm = (Colour) (m_src); \
|
||||
const uint m = (byte) (m_m); \
|
||||
const uint r = remap[m]; \
|
||||
const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \
|
||||
m_colour = r == 0 ? m_colour : cmap; \
|
||||
m_colour = m != 0 ? m_colour : srcm; \
|
||||
}
|
||||
#ifdef _SQ64
|
||||
uint64 srcs = _mm_cvtsi128_si64(srcABCD);
|
||||
uint64 dsts;
|
||||
if (animated) dsts = _mm_cvtsi128_si64(dstABCD);
|
||||
uint64 remapped_src = 0;
|
||||
CMOV_REMAP(c0, animated ? dsts : 0, srcs, mvX2);
|
||||
remapped_src = c0.data;
|
||||
CMOV_REMAP(c1, animated ? dsts >> 32 : 0, srcs >> 32, mvX2 >> 16);
|
||||
remapped_src |= (uint64) c1.data << 32;
|
||||
srcABCD = _mm_cvtsi64_si128(remapped_src);
|
||||
#else
|
||||
Colour remapped_src[2];
|
||||
CMOV_REMAP(c0, animated ? _mm_cvtsi128_si32(dstABCD) : 0, _mm_cvtsi128_si32(srcABCD), mvX2);
|
||||
remapped_src[0] = c0.data;
|
||||
CMOV_REMAP(c1, animated ? dst[1] : 0, src[1], mvX2 >> 16);
|
||||
remapped_src[1] = c1.data;
|
||||
srcABCD = _mm_loadl_epi64((__m128i*) &remapped_src);
|
||||
#endif
|
||||
|
||||
if ((mvX2 & 0xFF00FF00) != 0x80008000) srcABCD = AdjustBrightnessOfTwoPixels(srcABCD, mvX2);
|
||||
}
|
||||
|
||||
/* Update anim buffer. */
|
||||
if (animated) {
|
||||
const byte a0 = src[0].a;
|
||||
const byte a1 = src[1].a;
|
||||
uint32 anim01 = mvX2 & 0xFF00FF00;
|
||||
if (a0 == 255) {
|
||||
anim01 |= r0;
|
||||
if (a1 == 255) {
|
||||
*(uint32*) anim = anim01 | (r1 << 16);
|
||||
goto bmcr_full_opacity;
|
||||
}
|
||||
} else if (a0 == 0) {
|
||||
if (a1 == 0) {
|
||||
goto bmcr_full_transparency;
|
||||
} else {
|
||||
if (a1 == 255) {
|
||||
anim[1] = r1 | (anim01 >> 16);
|
||||
}
|
||||
goto bmcr_alpha_blend;
|
||||
}
|
||||
}
|
||||
if (a1 > 0) {
|
||||
if (a1 == 255) anim01 |= r1 << 16;
|
||||
*(uint32*) anim = anim01;
|
||||
} else {
|
||||
anim[0] = (uint16) anim01;
|
||||
}
|
||||
} else {
|
||||
if (src[0].a) anim[0] = 0;
|
||||
if (src[1].a) anim[1] = 0;
|
||||
}
|
||||
|
||||
/* Blend colours. */
|
||||
bmcr_alpha_blend:
|
||||
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm);
|
||||
bmcr_full_opacity:
|
||||
_mm_storel_epi64((__m128i *) dst, srcABCD);
|
||||
bmcr_full_transparency:
|
||||
src_mv += 2;
|
||||
dst += 2;
|
||||
src += 2;
|
||||
anim += 2;
|
||||
}
|
||||
|
||||
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
|
||||
/* In case the m-channel is zero, do not remap this pixel in any way. */
|
||||
__m128i srcABCD;
|
||||
if (src->a == 0) break;
|
||||
if (src_mv->m) {
|
||||
const uint r = remap[src_mv->m];
|
||||
*anim = (animated && src->a == 255) ? r | ((uint16) src_mv->v << 8 ) : 0;
|
||||
if (r != 0) {
|
||||
Colour remapped_colour = AdjustBrightneSSE(this->LookupColourInPalette(r), src_mv->v);
|
||||
if (src->a == 255) {
|
||||
*dst = remapped_colour;
|
||||
} else {
|
||||
remapped_colour.a = src->a;
|
||||
srcABCD = _mm_cvtsi32_si128(remapped_colour.data);
|
||||
goto bmcr_alpha_blend_single;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*anim = 0;
|
||||
srcABCD = _mm_cvtsi32_si128(src->data);
|
||||
if (src->a < 255) {
|
||||
bmcr_alpha_blend_single:
|
||||
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
|
||||
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm);
|
||||
}
|
||||
dst->data = _mm_cvtsi128_si32(srcABCD);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
/* Make the current colour a bit more black, so it looks like this image is transparent. */
|
||||
for (uint x = (uint) bp->width / 2; x > 0; x--) {
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
|
||||
_mm_storel_epi64((__m128i *) dst, DarkenTwoPixels(srcABCD, dstABCD, a_cm, tr_nom_base));
|
||||
src += 2;
|
||||
dst += 2;
|
||||
anim += 2;
|
||||
if (src[-2].a) anim[-2] = 0;
|
||||
if (src[-1].a) anim[-1] = 0;
|
||||
}
|
||||
|
||||
if ((bt_last == BT_NONE && bp->width & 1) || bt_last == BT_ODD) {
|
||||
__m128i srcABCD = _mm_cvtsi32_si128(src->data);
|
||||
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
|
||||
dst->data = _mm_cvtsi128_si32(DarkenTwoPixels(srcABCD, dstABCD, a_cm, tr_nom_base));
|
||||
if (src[0].a) anim[0] = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
for (uint x = (uint) bp->width; x > 0; x--) {
|
||||
if (src_mv->m == 0) {
|
||||
if (src->a != 0) {
|
||||
uint8 g = MakeDark(src->r, src->g, src->b);
|
||||
*dst = ComposeColourRGBA(g, g, g, src->a, *dst);
|
||||
*anim = 0;
|
||||
}
|
||||
} else {
|
||||
uint r = remap[src_mv->m];
|
||||
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), src_mv->v), src->a, *dst);
|
||||
}
|
||||
src_mv++;
|
||||
dst++;
|
||||
src++;
|
||||
anim++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
next_line:
|
||||
if (mode != BM_TRANSPARENT) src_mv_line += si->sprite_width;
|
||||
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
|
||||
dst_line += bp->pitch;
|
||||
anim_line += this->anim_buf_width;
|
||||
}
|
||||
}
|
||||
IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
|
||||
*
|
||||
* @param bp further blitting parameters
|
||||
* @param mode blitter mode
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
void Blitter_32bppSSE4_Anim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
{
|
||||
const Blitter_32bppSSE_Base::SpriteFlags sprite_flags = ((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags;
|
||||
switch (mode) {
|
||||
default: {
|
||||
bm_normal:
|
||||
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
|
||||
const BlockType bt_last = (BlockType) (bp->width & 1);
|
||||
if (bt_last == BT_EVEN) {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true, true>(bp, zoom);
|
||||
} else {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true, true>(bp, zoom);
|
||||
}
|
||||
} else {
|
||||
#ifdef _SQ64
|
||||
if (sprite_flags & SF_TRANSLUCENT) {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
|
||||
} else {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false, true>(bp, zoom);
|
||||
}
|
||||
#else
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BM_COLOUR_REMAP:
|
||||
if (sprite_flags & SF_NO_REMAP) goto bm_normal;
|
||||
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true, true>(bp, zoom);
|
||||
} else {
|
||||
if (sprite_flags & SF_NO_ANIM) Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
|
||||
else Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
|
||||
}
|
||||
break;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* WITH_SSE */
|
53
src/blitter/32bpp_anim_sse4.hpp
Normal file
53
src/blitter/32bpp_anim_sse4.hpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_sse4_anim.hpp A SSE4 32 bpp blitter with animation support. */
|
||||
|
||||
#ifndef BLITTER_32BPP_SSE4_ANIM_HPP
|
||||
#define BLITTER_32BPP_SSE4_ANIM_HPP
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
#ifndef SSE_VERSION
|
||||
#define SSE_VERSION 4
|
||||
#endif
|
||||
|
||||
#ifndef FULL_ANIMATION
|
||||
#define FULL_ANIMATION 1
|
||||
#endif
|
||||
|
||||
#include "32bpp_anim.hpp"
|
||||
#include "32bpp_sse4.hpp"
|
||||
|
||||
#undef MARGIN_NORMAL_THRESHOLD
|
||||
#define MARGIN_NORMAL_THRESHOLD 4
|
||||
|
||||
/** The SSE4 32 bpp blitter with palette animation. */
|
||||
class Blitter_32bppSSE4_Anim FINAL : public Blitter_32bppAnim, public Blitter_32bppSSE_Base {
|
||||
private:
|
||||
|
||||
public:
|
||||
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent, bool animated>
|
||||
/* virtual */ void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) {
|
||||
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
|
||||
}
|
||||
/* virtual */ const char *GetName() { return "32bpp-sse4-anim"; }
|
||||
};
|
||||
|
||||
/** Factory for the SSE4 32 bpp blitter (with palette animation). */
|
||||
class FBlitter_32bppSSE4_Anim: public BlitterFactory {
|
||||
public:
|
||||
FBlitter_32bppSSE4_Anim() : BlitterFactory("32bpp-sse4-anim", "SSE4 Blitter (palette animation)", HasCPUIDFlag(1, 2, 19)) {}
|
||||
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE4_Anim(); }
|
||||
};
|
||||
|
||||
#endif /* WITH_SSE */
|
||||
#endif /* BLITTER_32BPP_SSE4_ANIM_HPP */
|
@@ -112,6 +112,19 @@ public:
|
||||
return Colour(r * nom / denom, g * nom / denom, b * nom / denom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a colour dark grey, for specialized 32bpp remapping.
|
||||
* @param r red component
|
||||
* @param g green component
|
||||
* @param b blue component
|
||||
* @return the brightness value of the new colour, now dark grey.
|
||||
*/
|
||||
static inline uint8 MakeDark(uint8 r, uint8 g, uint8 b)
|
||||
{
|
||||
/* Magic-numbers are ~66% of those used in MakeGrey() */
|
||||
return ((r * 13063) + (g * 25647) + (b * 4981)) / 65536;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a colour grey - based.
|
||||
* @param colour the colour to make grey.
|
||||
|
@@ -141,6 +141,40 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
if (src_px->a == 255) {
|
||||
do {
|
||||
uint m = *src_n;
|
||||
if (m == 0) {
|
||||
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
|
||||
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
|
||||
} else {
|
||||
uint r = remap[GB(m, 0, 8)];
|
||||
if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
|
||||
}
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
} else {
|
||||
do {
|
||||
uint m = *src_n;
|
||||
if (m == 0) {
|
||||
if (src_px->a != 0) {
|
||||
uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
|
||||
*dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
|
||||
}
|
||||
} else {
|
||||
uint r = remap[GB(m, 0, 8)];
|
||||
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
|
||||
}
|
||||
dst++;
|
||||
src_px++;
|
||||
src_n++;
|
||||
} while (--n != 0);
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
|
||||
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
|
||||
@@ -204,6 +238,7 @@ void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode,
|
||||
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
|
||||
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,10 +32,9 @@ public:
|
||||
};
|
||||
|
||||
/** Factory for the optimised 32 bpp blitter (without palette animation). */
|
||||
class FBlitter_32bppOptimized : public BlitterFactory<FBlitter_32bppOptimized> {
|
||||
class FBlitter_32bppOptimized : public BlitterFactory {
|
||||
public:
|
||||
/* virtual */ const char *GetName() { return "32bpp-optimized"; }
|
||||
/* virtual */ const char *GetDescription() { return "32bpp Optimized Blitter (no palette animation)"; }
|
||||
FBlitter_32bppOptimized() : BlitterFactory("32bpp-optimized", "32bpp Optimized Blitter (no palette animation)") {}
|
||||
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppOptimized(); }
|
||||
};
|
||||
|
||||
|
@@ -45,6 +45,17 @@ void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoo
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
if (src->m == 0) {
|
||||
if (src->a != 0) {
|
||||
uint8 g = MakeDark(src->r, src->g, src->b);
|
||||
*dst = ComposeColourRGBA(g, g, g, src->a, *dst);
|
||||
}
|
||||
} else {
|
||||
if (bp->remap[src->m] != 0) *dst = ComposeColourPA(this->AdjustBrightness(this->LookupColourInPalette(bp->remap[src->m]), src->v), src->a, *dst);
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
|
||||
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
|
||||
|
@@ -34,10 +34,9 @@ public:
|
||||
};
|
||||
|
||||
/** Factory for the simple 32 bpp blitter. */
|
||||
class FBlitter_32bppSimple : public BlitterFactory<FBlitter_32bppSimple> {
|
||||
class FBlitter_32bppSimple : public BlitterFactory {
|
||||
public:
|
||||
/* virtual */ const char *GetName() { return "32bpp-simple"; }
|
||||
/* virtual */ const char *GetDescription() { return "32bpp Simple Blitter (no palette animation)"; }
|
||||
FBlitter_32bppSimple() : BlitterFactory("32bpp-simple", "32bpp Simple Blitter (no palette animation)") {}
|
||||
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSimple(); }
|
||||
};
|
||||
|
||||
|
141
src/blitter/32bpp_sse2.cpp
Normal file
141
src/blitter/32bpp_sse2.cpp
Normal file
@@ -0,0 +1,141 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_sse2.cpp Implementation of the SSE2 32 bpp blitter. */
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../zoom_func.h"
|
||||
#include "../settings_type.h"
|
||||
#include "32bpp_sse2.hpp"
|
||||
#include "32bpp_sse_func.hpp"
|
||||
|
||||
/** Instantiation of the SSE2 32bpp blitter factory. */
|
||||
static FBlitter_32bppSSE2 iFBlitter_32bppSSE2;
|
||||
|
||||
Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
|
||||
{
|
||||
/* First uint32 of a line = the number of transparent pixels from the left.
|
||||
* Second uint32 of a line = the number of transparent pixels from the right.
|
||||
* Then all RGBA then all MV.
|
||||
*/
|
||||
ZoomLevel zoom_min = ZOOM_LVL_NORMAL;
|
||||
ZoomLevel zoom_max = ZOOM_LVL_NORMAL;
|
||||
if (sprite->type != ST_FONT) {
|
||||
zoom_min = _settings_client.gui.zoom_min;
|
||||
zoom_max = _settings_client.gui.zoom_max;
|
||||
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_MAX;
|
||||
}
|
||||
|
||||
/* Calculate sizes and allocate. */
|
||||
SpriteData sd;
|
||||
memset(&sd, 0, sizeof(sd));
|
||||
uint all_sprites_size = 0;
|
||||
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
|
||||
const SpriteLoader::Sprite *src_sprite = &sprite[z];
|
||||
sd.infos[z].sprite_width = src_sprite->width;
|
||||
sd.infos[z].sprite_offset = all_sprites_size;
|
||||
sd.infos[z].sprite_line_size = sizeof(Colour) * src_sprite->width + sizeof(uint32) * META_LENGTH;
|
||||
|
||||
const uint rgba_size = sd.infos[z].sprite_line_size * src_sprite->height;
|
||||
sd.infos[z].mv_offset = all_sprites_size + rgba_size;
|
||||
|
||||
const uint mv_size = sizeof(MapValue) * src_sprite->width * src_sprite->height;
|
||||
all_sprites_size += rgba_size + mv_size;
|
||||
}
|
||||
|
||||
Sprite *dst_sprite = (Sprite *) allocator(sizeof(Sprite) + sizeof(SpriteData) + all_sprites_size);
|
||||
dst_sprite->height = sprite->height;
|
||||
dst_sprite->width = sprite->width;
|
||||
dst_sprite->x_offs = sprite->x_offs;
|
||||
dst_sprite->y_offs = sprite->y_offs;
|
||||
memcpy(dst_sprite->data, &sd, sizeof(SpriteData));
|
||||
|
||||
/* Copy colours and determine flags. */
|
||||
bool has_remap = false;
|
||||
bool has_anim = false;
|
||||
bool has_translucency = false;
|
||||
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
|
||||
const SpriteLoader::Sprite *src_sprite = &sprite[z];
|
||||
const SpriteLoader::CommonPixel *src = (const SpriteLoader::CommonPixel *) src_sprite->data;
|
||||
Colour *dst_rgba_line = (Colour *) &dst_sprite->data[sizeof(SpriteData) + sd.infos[z].sprite_offset];
|
||||
MapValue *dst_mv = (MapValue *) &dst_sprite->data[sizeof(SpriteData) + sd.infos[z].mv_offset];
|
||||
for (uint y = src_sprite->height; y != 0; y--) {
|
||||
Colour *dst_rgba = dst_rgba_line + META_LENGTH;
|
||||
for (uint x = src_sprite->width; x != 0; x--) {
|
||||
if (src->a != 0) {
|
||||
dst_rgba->a = src->a;
|
||||
if (src->a != 0 && src->a != 255) has_translucency = true;
|
||||
dst_mv->m = src->m;
|
||||
if (src->m != 0) {
|
||||
/* Do some accounting for flags. */
|
||||
has_remap = true;
|
||||
if (src->m >= PALETTE_ANIM_START) has_anim = true;
|
||||
|
||||
/* Get brightest value (or default brightness if it's a black pixel). */
|
||||
const uint8 rgb_max = max(src->r, max(src->g, src->b));
|
||||
dst_mv->v = (rgb_max == 0) ? Blitter_32bppBase::DEFAULT_BRIGHTNESS : rgb_max;
|
||||
|
||||
/* Pre-convert the mapping channel to a RGB value. */
|
||||
const Colour colour = AdjustBrightneSSE(Blitter_32bppBase::LookupColourInPalette(src->m), dst_mv->v);
|
||||
dst_rgba->r = colour.r;
|
||||
dst_rgba->g = colour.g;
|
||||
dst_rgba->b = colour.b;
|
||||
} else {
|
||||
dst_rgba->r = src->r;
|
||||
dst_rgba->g = src->g;
|
||||
dst_rgba->b = src->b;
|
||||
dst_mv->v = Blitter_32bppBase::DEFAULT_BRIGHTNESS;
|
||||
}
|
||||
} else {
|
||||
dst_rgba->data = 0;
|
||||
*(uint16*) dst_mv = 0;
|
||||
}
|
||||
dst_rgba++;
|
||||
dst_mv++;
|
||||
src++;
|
||||
}
|
||||
|
||||
/* Count the number of transparent pixels from the left. */
|
||||
dst_rgba = dst_rgba_line + META_LENGTH;
|
||||
uint32 nb_pix_transp = 0;
|
||||
for (uint x = src_sprite->width; x != 0; x--) {
|
||||
if (dst_rgba->a == 0) nb_pix_transp++;
|
||||
else break;
|
||||
dst_rgba++;
|
||||
}
|
||||
(*dst_rgba_line).data = nb_pix_transp;
|
||||
|
||||
Colour *nb_right = dst_rgba_line + 1;
|
||||
dst_rgba_line = (Colour*) ((byte*) dst_rgba_line + sd.infos[z].sprite_line_size);
|
||||
|
||||
/* Count the number of transparent pixels from the right. */
|
||||
dst_rgba = dst_rgba_line - 1;
|
||||
nb_pix_transp = 0;
|
||||
for (uint x = src_sprite->width; x != 0; x--) {
|
||||
if (dst_rgba->a == 0) nb_pix_transp++;
|
||||
else break;
|
||||
dst_rgba--;
|
||||
}
|
||||
(*nb_right).data = nb_pix_transp;
|
||||
}
|
||||
}
|
||||
|
||||
/* Store sprite flags. */
|
||||
sd.flags = SF_NONE;
|
||||
if (has_translucency) sd.flags |= SF_TRANSLUCENT;
|
||||
if (!has_remap) sd.flags |= SF_NO_REMAP;
|
||||
if (!has_anim) sd.flags |= SF_NO_ANIM;
|
||||
memcpy(dst_sprite->data, &sd, sizeof(SpriteData));
|
||||
|
||||
return dst_sprite;
|
||||
}
|
||||
|
||||
#endif /* WITH_SSE */
|
104
src/blitter/32bpp_sse2.hpp
Normal file
104
src/blitter/32bpp_sse2.hpp
Normal file
@@ -0,0 +1,104 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_sse2.hpp SSE2 32 bpp blitter. */
|
||||
|
||||
#ifndef BLITTER_32BPP_SSE2_HPP
|
||||
#define BLITTER_32BPP_SSE2_HPP
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
#ifndef SSE_VERSION
|
||||
#define SSE_VERSION 2
|
||||
#endif
|
||||
|
||||
#ifndef FULL_ANIMATION
|
||||
#define FULL_ANIMATION 0
|
||||
#endif
|
||||
|
||||
#include "32bpp_sse_type.h"
|
||||
|
||||
/** Base methods for 32bpp SSE blitters. */
|
||||
class Blitter_32bppSSE_Base {
|
||||
public:
|
||||
virtual ~Blitter_32bppSSE_Base() {}
|
||||
|
||||
struct MapValue {
|
||||
uint8 m;
|
||||
uint8 v;
|
||||
};
|
||||
assert_compile(sizeof(MapValue) == 2);
|
||||
|
||||
/** Helper for creating specialised functions for specific optimisations. */
|
||||
enum ReadMode {
|
||||
RM_WITH_SKIP, ///< Use normal code for skipping empty pixels.
|
||||
RM_WITH_MARGIN, ///< Use cached number of empty pixels at begin and end of line to reduce work.
|
||||
RM_NONE, ///< No specialisation.
|
||||
};
|
||||
|
||||
/** Helper for creating specialised functions for the case where the sprite width is odd or even. */
|
||||
enum BlockType {
|
||||
BT_EVEN, ///< An even number of pixels in the width; no need for a special case for the last pixel.
|
||||
BT_ODD, ///< An odd number of pixels in the width; special case for the last pixel.
|
||||
BT_NONE, ///< No specialisation for either case.
|
||||
};
|
||||
|
||||
/** Helper for using specialised functions designed to prevent whenever it's possible things like:
|
||||
* - IO (reading video buffer),
|
||||
* - calculations (alpha blending),
|
||||
* - heavy branching (remap lookups and animation buffer handling).
|
||||
*/
|
||||
enum SpriteFlags {
|
||||
SF_NONE = 0,
|
||||
SF_TRANSLUCENT = 1 << 1, ///< The sprite has at least 1 translucent pixel.
|
||||
SF_NO_REMAP = 1 << 2, ///< The sprite has no remappable colour pixel.
|
||||
SF_NO_ANIM = 1 << 3, ///< The sprite has no palette animated pixel.
|
||||
};
|
||||
|
||||
/** Data stored about a (single) sprite. */
|
||||
struct SpriteInfo {
|
||||
uint32 sprite_offset; ///< The offset to the sprite data.
|
||||
uint32 mv_offset; ///< The offset to the map value data.
|
||||
uint16 sprite_line_size; ///< The size of a single line (pitch).
|
||||
uint16 sprite_width; ///< The width of the sprite.
|
||||
};
|
||||
struct SpriteData {
|
||||
SpriteFlags flags;
|
||||
SpriteInfo infos[ZOOM_LVL_COUNT];
|
||||
byte data[]; ///< Data, all zoomlevels.
|
||||
};
|
||||
|
||||
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
|
||||
};
|
||||
|
||||
DECLARE_ENUM_AS_BIT_SET(Blitter_32bppSSE_Base::SpriteFlags);
|
||||
|
||||
/** The SSE2 32 bpp blitter (without palette animation). */
|
||||
class Blitter_32bppSSE2 : public Blitter_32bppSimple, public Blitter_32bppSSE_Base {
|
||||
public:
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
|
||||
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
|
||||
/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) {
|
||||
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
|
||||
}
|
||||
|
||||
/* virtual */ const char *GetName() { return "32bpp-sse2"; }
|
||||
};
|
||||
|
||||
/** Factory for the SSE2 32 bpp blitter (without palette animation). */
|
||||
class FBlitter_32bppSSE2 : public BlitterFactory {
|
||||
public:
|
||||
FBlitter_32bppSSE2() : BlitterFactory("32bpp-sse2", "32bpp SSE2 Blitter (no palette animation)", HasCPUIDFlag(1, 3, 26)) {}
|
||||
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE2(); }
|
||||
};
|
||||
|
||||
#endif /* WITH_SSE */
|
||||
#endif /* BLITTER_32BPP_SSE2_HPP */
|
23
src/blitter/32bpp_sse4.cpp
Normal file
23
src/blitter/32bpp_sse4.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_sse4.cpp Implementation of the SSE4 32 bpp blitter. */
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../zoom_func.h"
|
||||
#include "../settings_type.h"
|
||||
#include "32bpp_sse4.hpp"
|
||||
#include "32bpp_sse_func.hpp"
|
||||
|
||||
/** Instantiation of the SSE4 32bpp blitter factory. */
|
||||
static FBlitter_32bppSSE4 iFBlitter_32bppSSE4;
|
||||
|
||||
#endif /* WITH_SSE */
|
44
src/blitter/32bpp_sse4.hpp
Normal file
44
src/blitter/32bpp_sse4.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_sse4.hpp SSE4 32 bpp blitter. */
|
||||
|
||||
#ifndef BLITTER_32BPP_SSE4_HPP
|
||||
#define BLITTER_32BPP_SSE4_HPP
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
#ifndef SSE_VERSION
|
||||
#define SSE_VERSION 4
|
||||
#endif
|
||||
|
||||
#ifndef FULL_ANIMATION
|
||||
#define FULL_ANIMATION 0
|
||||
#endif
|
||||
|
||||
#include "32bpp_ssse3.hpp"
|
||||
|
||||
/** The SSE4 32 bpp blitter (without palette animation). */
|
||||
class Blitter_32bppSSE4 : public Blitter_32bppSSSE3 {
|
||||
public:
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
|
||||
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
/* virtual */ const char *GetName() { return "32bpp-sse4"; }
|
||||
};
|
||||
|
||||
/** Factory for the SSE4 32 bpp blitter (without palette animation). */
|
||||
class FBlitter_32bppSSE4: public BlitterFactory {
|
||||
public:
|
||||
FBlitter_32bppSSE4() : BlitterFactory("32bpp-sse4", "32bpp SSE4 Blitter (no palette animation)", HasCPUIDFlag(1, 2, 19)) {}
|
||||
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE4(); }
|
||||
};
|
||||
|
||||
#endif /* WITH_SSE */
|
||||
#endif /* BLITTER_32BPP_SSE4_HPP */
|
455
src/blitter/32bpp_sse_func.hpp
Normal file
455
src/blitter/32bpp_sse_func.hpp
Normal file
@@ -0,0 +1,455 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_sse_func.hpp Functions related to SSE 32 bpp blitter. */
|
||||
|
||||
#ifndef BLITTER_32BPP_SSE_FUNC_HPP
|
||||
#define BLITTER_32BPP_SSE_FUNC_HPP
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
static inline void InsertFirstUint32(const uint32 value, __m128i &into)
|
||||
{
|
||||
#if (SSE_VERSION >= 4)
|
||||
into = _mm_insert_epi32(into, value, 0);
|
||||
#else
|
||||
into = _mm_insert_epi16(into, value, 0);
|
||||
into = _mm_insert_epi16(into, value >> 16, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void InsertSecondUint32(const uint32 value, __m128i &into)
|
||||
{
|
||||
#if (SSE_VERSION >= 4)
|
||||
into = _mm_insert_epi32(into, value, 1);
|
||||
#else
|
||||
into = _mm_insert_epi16(into, value, 2);
|
||||
into = _mm_insert_epi16(into, value >> 16, 3);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void LoadUint64(const uint64 value, __m128i &into)
|
||||
{
|
||||
#ifdef _SQ64
|
||||
into = _mm_cvtsi64_si128(value);
|
||||
#else
|
||||
#if (SSE_VERSION >= 4)
|
||||
into = _mm_cvtsi32_si128(value);
|
||||
InsertSecondUint32(value >> 32, into);
|
||||
#else
|
||||
(*(um128i*) &into).m128i_u64[0] = value;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline __m128i PackUnsaturated(__m128i from, const __m128i &mask)
|
||||
{
|
||||
#if (SSE_VERSION == 2)
|
||||
from = _mm_and_si128(from, mask); // PAND, wipe high bytes to keep low bytes when packing
|
||||
return _mm_packus_epi16(from, from); // PACKUSWB, pack 2 colours (with saturation)
|
||||
#else
|
||||
return _mm_shuffle_epi8(from, mask);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
|
||||
{
|
||||
#if (SSE_VERSION == 2)
|
||||
__m128i alphaAB = _mm_shufflelo_epi16(from, 0x3F); // PSHUFLW, put alpha1 in front of each rgb1
|
||||
return _mm_shufflehi_epi16(alphaAB, 0x3F); // PSHUFHW, put alpha2 in front of each rgb2
|
||||
#else
|
||||
return _mm_shuffle_epi8(from, mask);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask)
|
||||
{
|
||||
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); // PUNPCKLBW, expand each uint8 into uint16
|
||||
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
|
||||
|
||||
__m128i alphaAB = _mm_cmpgt_epi16(srcAB, _mm_setzero_si128()); // PCMPGTW, if (alpha > 0) a++;
|
||||
alphaAB = _mm_srli_epi16(alphaAB, 15);
|
||||
alphaAB = _mm_add_epi16(alphaAB, srcAB);
|
||||
alphaAB = DistributeAlpha(alphaAB, distribution_mask);
|
||||
|
||||
srcAB = _mm_sub_epi16(srcAB, dstAB); // PSUBW, (r - Cr)
|
||||
srcAB = _mm_mullo_epi16(srcAB, alphaAB); // PMULLW, a*(r - Cr)
|
||||
srcAB = _mm_srli_epi16(srcAB, 8); // PSRLW, a*(r - Cr)/256
|
||||
srcAB = _mm_add_epi16(srcAB, dstAB); // PADDW, a*(r - Cr)/256 + Cr
|
||||
return PackUnsaturated(srcAB, pack_mask);
|
||||
}
|
||||
|
||||
/* Darken 2 pixels.
|
||||
* rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4)
|
||||
*/
|
||||
static inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &tr_nom_base)
|
||||
{
|
||||
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128());
|
||||
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
|
||||
__m128i alphaAB = DistributeAlpha(srcAB, distribution_mask);
|
||||
alphaAB = _mm_srli_epi16(alphaAB, 2); // Reduce to 64 levels of shades so the max value fits in 16 bits.
|
||||
__m128i nom = _mm_sub_epi16(tr_nom_base, alphaAB);
|
||||
dstAB = _mm_mullo_epi16(dstAB, nom);
|
||||
dstAB = _mm_srli_epi16(dstAB, 8);
|
||||
return _mm_packus_epi16(dstAB, dstAB);
|
||||
}
|
||||
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
static Colour ReallyAdjustBrightness(Colour colour, uint8 brightness)
|
||||
{
|
||||
uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32;
|
||||
c16 *= brightness;
|
||||
uint64 c16_ob = c16; // Helps out of order execution.
|
||||
c16 /= Blitter_32bppBase::DEFAULT_BRIGHTNESS;
|
||||
c16 &= 0x01FF01FF01FFULL;
|
||||
|
||||
/* Sum overbright (maximum for each rgb is 508, 9 bits, -255 is changed in -256 so we just have to take the 8 lower bits into account). */
|
||||
c16_ob = (((c16_ob >> (8 + 7)) & 0x0100010001ULL) * 0xFF) & c16;
|
||||
const uint ob = ((uint16) c16_ob + (uint16) (c16_ob >> 16) + (uint16) (c16_ob >> 32)) / 2;
|
||||
|
||||
const uint32 alpha32 = colour.data & 0xFF000000;
|
||||
__m128i ret;
|
||||
LoadUint64(c16, ret);
|
||||
if (ob != 0) {
|
||||
__m128i ob128 = _mm_cvtsi32_si128(ob);
|
||||
ob128 = _mm_shufflelo_epi16(ob128, 0xC0);
|
||||
__m128i white = OVERBRIGHT_VALUE_MASK;
|
||||
__m128i c128 = ret;
|
||||
ret = _mm_subs_epu16(white, c128); // PSUBUSW, (255 - rgb)
|
||||
ret = _mm_mullo_epi16(ret, ob128); // PMULLW, ob*(255 - rgb)
|
||||
ret = _mm_srli_epi16(ret, 8); // PSRLW, ob*(255 - rgb)/256
|
||||
ret = _mm_add_epi16(ret, c128); // PADDW, ob*(255 - rgb)/256 + rgb
|
||||
}
|
||||
|
||||
ret = _mm_packus_epi16(ret, ret); // PACKUSWB, saturate and pack.
|
||||
return alpha32 | _mm_cvtsi128_si32(ret);
|
||||
}
|
||||
IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
|
||||
/** ReallyAdjustBrightness() is not called that often.
|
||||
* Inlining this function implies a far jump, which has a huge latency.
|
||||
*/
|
||||
static inline Colour AdjustBrightneSSE(Colour colour, uint8 brightness)
|
||||
{
|
||||
/* Shortcut for normal brightness. */
|
||||
if (brightness == Blitter_32bppBase::DEFAULT_BRIGHTNESS) return colour;
|
||||
|
||||
return ReallyAdjustBrightness(colour, brightness);
|
||||
}
|
||||
|
||||
static inline __m128i AdjustBrightnessOfTwoPixels(__m128i from, uint32 brightness)
|
||||
{
|
||||
#if (SSE_VERSION < 3)
|
||||
NOT_REACHED();
|
||||
#else
|
||||
/* The following dataflow differs from the one of AdjustBrightness() only for alpha.
|
||||
* In order to keep alpha in colAB, insert a 1 in a unused brightness byte (a*1->a).
|
||||
* OK, not a 1 but DEFAULT_BRIGHTNESS to compensate the div.
|
||||
*/
|
||||
brightness &= 0xFF00FF00;
|
||||
brightness += Blitter_32bppBase::DEFAULT_BRIGHTNESS;
|
||||
|
||||
__m128i colAB = _mm_unpacklo_epi8(from, _mm_setzero_si128());
|
||||
__m128i briAB = _mm_cvtsi32_si128(brightness);
|
||||
briAB = _mm_shuffle_epi8(briAB, BRIGHTNESS_LOW_CONTROL_MASK); // DEFAULT_BRIGHTNESS in 0, 0x00 in 2.
|
||||
colAB = _mm_mullo_epi16(colAB, briAB);
|
||||
__m128i colAB_ob = _mm_srli_epi16(colAB, 8+7);
|
||||
colAB = _mm_srli_epi16(colAB, 7);
|
||||
|
||||
/* Sum overbright.
|
||||
* Maximum for each rgb is 508 => 9 bits. The highest bit tells if there is overbright.
|
||||
* -255 is changed in -256 so we just have to take the 8 lower bits into account.
|
||||
*/
|
||||
colAB = _mm_and_si128(colAB, BRIGHTNESS_DIV_CLEANER);
|
||||
colAB_ob = _mm_and_si128(colAB_ob, OVERBRIGHT_PRESENCE_MASK);
|
||||
colAB_ob = _mm_mullo_epi16(colAB_ob, OVERBRIGHT_VALUE_MASK);
|
||||
colAB_ob = _mm_and_si128(colAB_ob, colAB);
|
||||
__m128i obAB = _mm_hadd_epi16(_mm_hadd_epi16(colAB_ob, _mm_setzero_si128()), _mm_setzero_si128());
|
||||
|
||||
obAB = _mm_srli_epi16(obAB, 1); // Reduce overbright strength.
|
||||
obAB = _mm_shuffle_epi8(obAB, OVERBRIGHT_CONTROL_MASK);
|
||||
__m128i retAB = OVERBRIGHT_VALUE_MASK; // ob_mask is equal to white.
|
||||
retAB = _mm_subs_epu16(retAB, colAB); // (255 - rgb)
|
||||
retAB = _mm_mullo_epi16(retAB, obAB); // ob*(255 - rgb)
|
||||
retAB = _mm_srli_epi16(retAB, 8); // ob*(255 - rgb)/256
|
||||
retAB = _mm_add_epi16(retAB, colAB); // ob*(255 - rgb)/256 + rgb
|
||||
|
||||
return _mm_packus_epi16(retAB, retAB);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if FULL_ANIMATION == 0
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. It is templated to allow faster operation.
|
||||
*
|
||||
* @tparam mode blitter mode
|
||||
* @param bp further blitting parameters
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
IGNORE_UNINITIALIZED_WARNING_START
|
||||
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last, bool translucent>
|
||||
#if (SSE_VERSION == 2)
|
||||
inline void Blitter_32bppSSE2::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||
#elif (SSE_VERSION == 3)
|
||||
inline void Blitter_32bppSSSE3::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||
#elif (SSE_VERSION == 4)
|
||||
inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
|
||||
#endif
|
||||
{
|
||||
const byte * const remap = bp->remap;
|
||||
Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
|
||||
int effective_width = bp->width;
|
||||
|
||||
/* Find where to start reading in the source sprite. */
|
||||
const SpriteData * const sd = (const SpriteData *) bp->sprite;
|
||||
const SpriteInfo * const si = &sd->infos[zoom];
|
||||
const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width;
|
||||
const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
|
||||
|
||||
if (read_mode != RM_WITH_MARGIN) {
|
||||
src_rgba_line += bp->skip_left;
|
||||
src_mv_line += bp->skip_left;
|
||||
}
|
||||
const MapValue *src_mv = src_mv_line;
|
||||
|
||||
/* Load these variables into register before loop. */
|
||||
#if (SSE_VERSION == 2)
|
||||
const __m128i clear_hi = CLEAR_HIGH_BYTE_MASK;
|
||||
#define ALPHA_BLEND_PARAM_1 clear_hi
|
||||
#define ALPHA_BLEND_PARAM_2 clear_hi
|
||||
#define DARKEN_PARAM_1 tr_nom_base
|
||||
#define DARKEN_PARAM_2 tr_nom_base
|
||||
#else
|
||||
const __m128i a_cm = ALPHA_CONTROL_MASK;
|
||||
const __m128i pack_low_cm = PACK_LOW_CONTROL_MASK;
|
||||
#define ALPHA_BLEND_PARAM_1 a_cm
|
||||
#define ALPHA_BLEND_PARAM_2 pack_low_cm
|
||||
#define DARKEN_PARAM_1 a_cm
|
||||
#define DARKEN_PARAM_2 tr_nom_base
|
||||
#endif
|
||||
const __m128i tr_nom_base = TRANSPARENT_NOM_BASE;
|
||||
|
||||
for (int y = bp->height; y != 0; y--) {
|
||||
Colour *dst = dst_line;
|
||||
const Colour *src = src_rgba_line + META_LENGTH;
|
||||
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv = src_mv_line;
|
||||
|
||||
if (read_mode == RM_WITH_MARGIN) {
|
||||
assert(bt_last == BT_NONE); // or you must ensure block type is preserved
|
||||
src += src_rgba_line[0].data;
|
||||
dst += src_rgba_line[0].data;
|
||||
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv += src_rgba_line[0].data;
|
||||
const int width_diff = si->sprite_width - bp->width;
|
||||
effective_width = bp->width - (int) src_rgba_line[0].data;
|
||||
const int delta_diff = (int) src_rgba_line[1].data - width_diff;
|
||||
const int new_width = effective_width - delta_diff;
|
||||
effective_width = delta_diff > 0 ? new_width : effective_width;
|
||||
if (effective_width <= 0) goto next_line;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
default:
|
||||
if (!translucent) {
|
||||
for (uint x = (uint) effective_width; x > 0; x--) {
|
||||
if (src->a) *dst = *src;
|
||||
src++;
|
||||
dst++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (uint x = (uint) effective_width / 2; x > 0; x--) {
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
|
||||
_mm_storel_epi64((__m128i*) dst, AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2));
|
||||
src += 2;
|
||||
dst += 2;
|
||||
}
|
||||
|
||||
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
|
||||
__m128i srcABCD = _mm_cvtsi32_si128(src->data);
|
||||
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
|
||||
dst->data = _mm_cvtsi128_si32(AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2));
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_COLOUR_REMAP:
|
||||
#if (SSE_VERSION >= 3)
|
||||
for (uint x = (uint) effective_width / 2; x > 0; x--) {
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
|
||||
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
|
||||
|
||||
/* Remap colours. */
|
||||
if (mvX2 & 0x00FF00FF) {
|
||||
#define CMOV_REMAP(m_colour, m_colour_init, m_src, m_m) \
|
||||
/* Written so the compiler uses CMOV. */ \
|
||||
Colour m_colour = m_colour_init; \
|
||||
{ \
|
||||
const Colour srcm = (Colour) (m_src); \
|
||||
const uint m = (byte) (m_m); \
|
||||
const uint r = remap[m]; \
|
||||
const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \
|
||||
m_colour = r == 0 ? m_colour : cmap; \
|
||||
m_colour = m != 0 ? m_colour : srcm; \
|
||||
}
|
||||
#ifdef _SQ64
|
||||
uint64 srcs = _mm_cvtsi128_si64(srcABCD);
|
||||
uint64 remapped_src = 0;
|
||||
CMOV_REMAP(c0, 0, srcs, mvX2);
|
||||
remapped_src = c0.data;
|
||||
CMOV_REMAP(c1, 0, srcs >> 32, mvX2 >> 16);
|
||||
remapped_src |= (uint64) c1.data << 32;
|
||||
srcABCD = _mm_cvtsi64_si128(remapped_src);
|
||||
#else
|
||||
Colour remapped_src[2];
|
||||
CMOV_REMAP(c0, 0, _mm_cvtsi128_si32(srcABCD), mvX2);
|
||||
remapped_src[0] = c0.data;
|
||||
CMOV_REMAP(c1, 0, src[1], mvX2 >> 16);
|
||||
remapped_src[1] = c1.data;
|
||||
srcABCD = _mm_loadl_epi64((__m128i*) &remapped_src);
|
||||
#endif
|
||||
|
||||
if ((mvX2 & 0xFF00FF00) != 0x80008000) srcABCD = AdjustBrightnessOfTwoPixels(srcABCD, mvX2);
|
||||
}
|
||||
|
||||
/* Blend colours. */
|
||||
_mm_storel_epi64((__m128i *) dst, AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2));
|
||||
dst += 2;
|
||||
src += 2;
|
||||
src_mv += 2;
|
||||
}
|
||||
|
||||
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
|
||||
#else
|
||||
for (uint x = (uint) effective_width; x > 0; x--) {
|
||||
#endif
|
||||
/* In case the m-channel is zero, do not remap this pixel in any way. */
|
||||
__m128i srcABCD;
|
||||
if (src_mv->m) {
|
||||
const uint r = remap[src_mv->m];
|
||||
if (r != 0) {
|
||||
Colour remapped_colour = AdjustBrightneSSE(this->LookupColourInPalette(r), src_mv->v);
|
||||
if (src->a == 255) {
|
||||
*dst = remapped_colour;
|
||||
} else {
|
||||
remapped_colour.a = src->a;
|
||||
srcABCD = _mm_cvtsi32_si128(remapped_colour.data);
|
||||
goto bmcr_alpha_blend_single;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
srcABCD = _mm_cvtsi32_si128(src->data);
|
||||
if (src->a < 255) {
|
||||
bmcr_alpha_blend_single:
|
||||
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
|
||||
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2);
|
||||
}
|
||||
dst->data = _mm_cvtsi128_si32(srcABCD);
|
||||
}
|
||||
#if (SSE_VERSION == 2)
|
||||
src_mv++;
|
||||
dst++;
|
||||
src++;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_TRANSPARENT:
|
||||
/* Make the current colour a bit more black, so it looks like this image is transparent. */
|
||||
for (uint x = (uint) bp->width / 2; x > 0; x--) {
|
||||
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
|
||||
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
|
||||
_mm_storel_epi64((__m128i *) dst, DarkenTwoPixels(srcABCD, dstABCD, DARKEN_PARAM_1, DARKEN_PARAM_2));
|
||||
src += 2;
|
||||
dst += 2;
|
||||
}
|
||||
|
||||
if ((bt_last == BT_NONE && bp->width & 1) || bt_last == BT_ODD) {
|
||||
__m128i srcABCD = _mm_cvtsi32_si128(src->data);
|
||||
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
|
||||
dst->data = _mm_cvtsi128_si32(DarkenTwoPixels(srcABCD, dstABCD, DARKEN_PARAM_1, DARKEN_PARAM_2));
|
||||
}
|
||||
break;
|
||||
|
||||
case BM_CRASH_REMAP:
|
||||
for (uint x = (uint) bp->width; x > 0; x--) {
|
||||
if (src_mv->m == 0) {
|
||||
if (src->a != 0) {
|
||||
uint8 g = MakeDark(src->r, src->g, src->b);
|
||||
*dst = ComposeColourRGBA(g, g, g, src->a, *dst);
|
||||
}
|
||||
} else {
|
||||
uint r = remap[src_mv->m];
|
||||
if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), src_mv->v), src->a, *dst);
|
||||
}
|
||||
src_mv++;
|
||||
dst++;
|
||||
src++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
next_line:
|
||||
if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv_line += si->sprite_width;
|
||||
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
|
||||
dst_line += bp->pitch;
|
||||
}
|
||||
}
|
||||
IGNORE_UNINITIALIZED_WARNING_STOP
|
||||
|
||||
/**
|
||||
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
|
||||
*
|
||||
* @param bp further blitting parameters
|
||||
* @param mode blitter mode
|
||||
* @param zoom zoom level at which we are drawing
|
||||
*/
|
||||
#if (SSE_VERSION == 2)
|
||||
void Blitter_32bppSSE2::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
#elif (SSE_VERSION == 3)
|
||||
void Blitter_32bppSSSE3::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
#elif (SSE_VERSION == 4)
|
||||
void Blitter_32bppSSE4::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
|
||||
#endif
|
||||
{
|
||||
switch (mode) {
|
||||
default: {
|
||||
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
|
||||
bm_normal:
|
||||
const BlockType bt_last = (BlockType) (bp->width & 1);
|
||||
switch (bt_last) {
|
||||
default: Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true>(bp, zoom); return;
|
||||
case BT_ODD: Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true>(bp, zoom); return;
|
||||
}
|
||||
} else {
|
||||
if (((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags & SF_TRANSLUCENT) {
|
||||
Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom);
|
||||
} else {
|
||||
Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false>(bp, zoom);
|
||||
}
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BM_COLOUR_REMAP:
|
||||
if (((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags & SF_NO_REMAP) goto bm_normal;
|
||||
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
|
||||
Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true>(bp, zoom); return;
|
||||
} else {
|
||||
Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom); return;
|
||||
}
|
||||
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, RM_NONE, BT_NONE, true>(bp, zoom); return;
|
||||
}
|
||||
}
|
||||
#endif /* FULL_ANIMATION */
|
||||
|
||||
#endif /* WITH_SSE */
|
||||
#endif /* BLITTER_32BPP_SSE_FUNC_HPP */
|
56
src/blitter/32bpp_sse_type.h
Normal file
56
src/blitter/32bpp_sse_type.h
Normal file
@@ -0,0 +1,56 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_sse_type.hpp Types related to SSE 32 bpp blitter. */
|
||||
|
||||
#ifndef BLITTER_32BPP_SSE_TYPE_HPP
|
||||
#define BLITTER_32BPP_SSE_TYPE_HPP
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
#include "32bpp_simple.hpp"
|
||||
#if (SSE_VERSION == 2)
|
||||
#include <emmintrin.h>
|
||||
#elif (SSE_VERSION == 3)
|
||||
#include <tmmintrin.h>
|
||||
#elif (SSE_VERSION == 4)
|
||||
#include <smmintrin.h>
|
||||
#endif
|
||||
|
||||
#define META_LENGTH 2 ///< Number of uint32 inserted before each line of pixels in a sprite.
|
||||
#define MARGIN_NORMAL_THRESHOLD (zoom == ZOOM_LVL_OUT_32X ? 8 : 4) ///< Minimum width to use margins with BM_NORMAL.
|
||||
#define MARGIN_REMAP_THRESHOLD 4 ///< Minimum width to use margins with BM_COLOUR_REMAP.
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define ALIGN(n) __declspec(align(n))
|
||||
#else
|
||||
#define ALIGN(n) __attribute__ ((aligned (n)))
|
||||
#endif
|
||||
|
||||
typedef union ALIGN(16) um128i {
|
||||
__m128i m128i;
|
||||
uint8 m128i_u8[16];
|
||||
uint16 m128i_u16[8];
|
||||
uint32 m128i_u32[4];
|
||||
uint64 m128i_u64[2];
|
||||
} um128i;
|
||||
|
||||
#define CLEAR_HIGH_BYTE_MASK _mm_setr_epi8(-1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0)
|
||||
#define ALPHA_CONTROL_MASK _mm_setr_epi8( 6, 7, 6, 7, 6, 7, -1, -1, 14, 15, 14, 15, 14, 15, -1, -1)
|
||||
#define PACK_LOW_CONTROL_MASK _mm_setr_epi8( 0, 2, 4, -1, 8, 10, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1)
|
||||
#define PACK_HIGH_CONTROL_MASK _mm_setr_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 0, 2, 4, -1, 8, 10, 12, -1)
|
||||
#define BRIGHTNESS_LOW_CONTROL_MASK _mm_setr_epi8( 1, 2, 1, 2, 1, 2, 0, 2, 3, 2, 3, 2, 3, 2, 0, 2)
|
||||
#define BRIGHTNESS_DIV_CLEANER _mm_setr_epi8(-1, 1, -1, 1, -1, 1, -1, 0, -1, 1, -1, 1, -1, 1, -1, 0)
|
||||
#define OVERBRIGHT_PRESENCE_MASK _mm_setr_epi8( 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0)
|
||||
#define OVERBRIGHT_VALUE_MASK _mm_setr_epi8(-1, 0, -1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, 0, 0, 0)
|
||||
#define OVERBRIGHT_CONTROL_MASK _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 7, 7, 2, 3, 2, 3, 2, 3, 7, 7)
|
||||
#define TRANSPARENT_NOM_BASE _mm_setr_epi16(256, 256, 256, 256, 256, 256, 256, 256)
|
||||
|
||||
#endif /* WITH_SSE */
|
||||
#endif /* BLITTER_32BPP_SSE_TYPE_HPP */
|
23
src/blitter/32bpp_ssse3.cpp
Normal file
23
src/blitter/32bpp_ssse3.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_ssse3.cpp Implementation of the SSSE3 32 bpp blitter. */
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
#include "../stdafx.h"
|
||||
#include "../zoom_func.h"
|
||||
#include "../settings_type.h"
|
||||
#include "32bpp_ssse3.hpp"
|
||||
#include "32bpp_sse_func.hpp"
|
||||
|
||||
/** Instantiation of the SSSE3 32bpp blitter factory. */
|
||||
static FBlitter_32bppSSSE3 iFBlitter_32bppSSSE3;
|
||||
|
||||
#endif /* WITH_SSE */
|
44
src/blitter/32bpp_ssse3.hpp
Normal file
44
src/blitter/32bpp_ssse3.hpp
Normal file
@@ -0,0 +1,44 @@
|
||||
/* $Id$ */
|
||||
|
||||
/*
|
||||
* This file is part of OpenTTD.
|
||||
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
|
||||
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/** @file 32bpp_ssse3.hpp SSSE3 32 bpp blitter. */
|
||||
|
||||
#ifndef BLITTER_32BPP_SSSE3_HPP
|
||||
#define BLITTER_32BPP_SSSE3_HPP
|
||||
|
||||
#ifdef WITH_SSE
|
||||
|
||||
#ifndef SSE_VERSION
|
||||
#define SSE_VERSION 3
|
||||
#endif
|
||||
|
||||
#ifndef FULL_ANIMATION
|
||||
#define FULL_ANIMATION 0
|
||||
#endif
|
||||
|
||||
#include "32bpp_sse2.hpp"
|
||||
|
||||
/** The SSSE3 32 bpp blitter (without palette animation). */
|
||||
class Blitter_32bppSSSE3 : public Blitter_32bppSSE2 {
|
||||
public:
|
||||
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
|
||||
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
|
||||
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
|
||||
/* virtual */ const char *GetName() { return "32bpp-ssse3"; }
|
||||
};
|
||||
|
||||
/** Factory for the SSSE3 32 bpp blitter (without palette animation). */
|
||||
class FBlitter_32bppSSSE3: public BlitterFactory {
|
||||
public:
|
||||
FBlitter_32bppSSSE3() : BlitterFactory("32bpp-ssse3", "32bpp SSSE3 Blitter (no palette animation)", HasCPUIDFlag(1, 2, 9)) {}
|
||||
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSSE3(); }
|
||||
};
|
||||
|
||||
#endif /* WITH_SSE */
|
||||
#endif /* BLITTER_32BPP_SSSE3_HPP */
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user