Commit Graph

5657 Commits

Author SHA1 Message Date
Tamás Bálint Misius
a8d2b269b1
Move tricky compiler options over to build.sh
All of these are options that are specific to our ghactions builds and not something we want downstream and package maintainers to be locked into using.
2022-10-06 11:50:46 +02:00
Tamás Bálint Misius
304cc3a47b
Move Read/WriteFile from Client to Platform 2022-10-05 19:55:04 +02:00
Tamás Bálint Misius
084f196248
Add http.getAuthToken
This website API was created to enable TPTMP to prove the identity of connecting users, and while TPTMP works fine without explicit support for this from the game, it has to resort to parsing powder.pref. This is not only ugly but also likely to be disallowed by the next version of the script manager. This new script manager will probably come after 97.0, so it's okay for it to rely on a game feature that won't be available until 97.0.
2022-10-05 19:55:02 +02:00
Tamás Bálint Misius
e54df0e6ad
More Lua API 8-bit-cleanliness changes
Round 2 of what I started in 36d034dc2e, mostly fixing c_str usage where it's not sensible.
2022-10-05 11:38:35 +02:00
Tamás Bálint Misius
b4462273b0
Fix a very elusive PHOT reflection crash
get_normal_interp is given a PHOT and scans a line section starting from the PHOT, extended in the direction of its velocity, to determine the surface normal of the surface that is reflecting the PHOT. It uses is_boundary to detect "boundaries" on this line section, defined as one "blocking" cell with at least one "non-blocking" non-diagonal neighbour. It never actually makes sure the position it passes to is_boundary is within the simulation area, so I assume is_boundary is expected to handle this correctly.

Plot twist: it does not. It delegates checking whether a cell is "blocking" (defined as something PHOT would normally fail to move into as per eval_move, but GLAS and BLGA are handled specially) to is_blocking. is_blocking returns true for cells beyond the simulation area (as eval_move returns "no move" for such cells). Once is_boundary sees that the cell it's been given is blocking, it then proceeds to check whether any of its non-diagonal neighbours might be non-blocking. In most cases, non-diagonal neighbours of an out-of-bounds cell are also out of bounds and are thus blocking, but if the cell is_boundary is given is in the innermost layer of out-of-bounds cells, just beyond the simulation area, then it has a neighbour that is in bounds, and that one may not block PHOT. The takeaway is that out of bounds cells can indeed be boundaries, as far as is_boundary is concerned.

This is a problem because get_normal_interp's line section can easily reach beyond the simulation area if the PHOT's velocity is high enough, and if it finds a boundary along this line section, it immediately stops looking and passes its position to photoelectric_effect, which then uses this potentially out-of-bounds position to index pmap. A position with y = -1 causes photoelectric_effect to read from the last few slots of parts data that it then interprets as pmap entries, which then may direct it to particles to spark that are beyond parts. This eventually crashes.

This commit doesn't fix is_boundary's definition of boundaries, but it stops get_normal_interp looking at cells beyond the simulation area.

The crash is difficult to reproduce because there have to be many particles in the simulation for the very last slots of parts to be in use, and for them to point to memory that isn't accessible. PHOT also has to survive a try_move beyond the simulation area first (otherwise the reflection code isn't even run), which requires it to start from EHOLE. I have no idea why this is so. Reproduce the out of bounds read in photoelectric_effect with

	break Simulation.cpp:2934 if nx < 0

in gdb and executing the following Lua code:

	sim.clearSim()
	tpt.set_wallmap(55, 44, 12)
	local i = sim.partCreate(-1, 223, 178, 31)
	sim.partProperty(i, "vx", -300)
	sim.partProperty(i, "vy", 0)
	sim.framerender(1)
2022-10-02 22:57:36 +02:00
catsoften
5d66533f23
Make stickman movement strength independent of gravity (#857) 2022-09-25 14:49:43 +02:00
Tamás Bálint Misius
0f9b1a58b1
Add notification for missing or bad SSL certificates
Also add mbedtls to and document new certificate config options in README.md.
2022-09-25 07:22:23 +02:00
Tamás Bálint Misius
09c2704928
Add CAFile and CAPath config options, use mbedtls in static builds
This is how we'll handle systems where the cert bundle and cert directory is stored where mbedtls doesn't expect it.

Also update tpt-libs to get new curl and mbedtls.
2022-09-25 06:13:35 +02:00
Tamás Bálint Misius
b4213a20f7
Fix workflow sometimes releasing debug builds
Both the debug and release jobs would upload artifacts, with the same name, which ghactions of course accepted without question. Snapshot 240 happens to have been released correctly (so all binaries are release builds), but that's just luck. I'd thought I'd fixed this problem with another commit, but turns out I hadn't.

Also factor out a bunch of variables so I won't mess up in the future.
2022-09-15 12:11:52 +02:00
Tamás Bálint Misius
25d6ca9dec
Fix crash when trying to load a stamp that doesn't exist 2022-09-11 16:56:40 +02:00
Tamás Bálint Misius
fefafa3b3d
Display link command line when building for windows
Command line is limited in length on windows so meson/ninja puts it in a response file and passes that to the linker instead. Only problem is, ninja -v displays only the part of the command line where it tells link.exe where the response file is, not what's in the response file. So I just had the script print it. Care must also be taken for the script to properly fail if ninja fails, but not before the command line is printed.

Also add /GL and /LCTG to msvc command lines because they can't hurt. Right?
2022-09-11 14:15:34 +02:00
Tamás Bálint Misius
f42c8372d2
Fix release assets failing to upload 2022-09-11 07:15:36 +02:00
Tamás Bálint Misius
bc208a700f
Fix new workflow not creating releases in some cases 2022-09-11 06:49:07 +02:00
Tamás Bálint Misius
1f1f450177
Fix starcatcher uploads 2022-09-11 01:03:53 +02:00
Tamás Bálint Misius
a674498a96
Clean up Client::DoInstallation
Also Factor out app constants that mods might change into Meson options and clean up format::URLEncode in the process, convert app and document icon data in arrays to actual images, actualize AppStream data for possible future packaging, add alternative command line format for opening filesystem saves and ptsave URLs, fix a memory leak in Platform::GetCwd, and add format::URLDecode.
2022-09-08 06:54:35 +02:00
Tamás Bálint Misius
04e899e824
Use std::vector<char> consistently for file operations
This made it possible to get rid of two GameSave constructors.

Also clean up Client::LoadSaveFile, Client::ReadFile, and Client::WriteFile in the process, and remove unused SaveRenderer::Render
2022-09-08 06:45:25 +02:00
Tamás Bálint Misius
69faea971f
Enable By date button when viewing Favorites 2022-09-07 13:01:52 +02:00
Tamás Bálint Misius
513d2cae3e
Update tpt-libs
Also restructure meson.build and the ghactions workflow a bit, and enable -ffunction-sections and -fdata-sections.

Note that starcatcher uploads have not been tested and most likely don't work.
2022-09-03 07:01:21 +02:00
Tamás Bálint Misius
ed13f33e7a
Fix invalid stamps names being accepted
The .size() == 14 check got lost in the last commit.
2022-08-31 18:52:00 +02:00
Tamás Bálint Misius
9e712eba08
Remove dependency on dirent.h on windows
Also fix a few bugs and other weirdness in Platform::DirectorySearch. Empty string paths would crash and filenames with 4 or fewer characters wouldn't register.
2022-08-30 20:39:44 +02:00
Tamás Bálint Misius
6ba5de6034
Crop stamp thumbnails that don't fit even when resized 2022-08-28 07:12:46 +02:00
Tamás Bálint Misius
23a368dbf0
Clean up DirectionSelector and surrounding code
I really should have done this before merging it >_>

Also fix a few warnings.
2022-08-23 13:47:45 +02:00
Tamás Bálint Misius
36d034dc2e
Fix 8-bit-uncleanliness of most of the Lua API
This fixes bugs like "type\0hello mom" being a property name sim.partProperty accepts and half-fixes bugs like text formatting codes making gfx.drawText exit prematurely.
2022-08-22 19:42:51 +02:00
Tamás Bálint Misius
3c6bd74389
Return HTTP response headers to Lua
Also accept request headers in a string array format, beside the old string-string dictionary format.
2022-08-21 20:54:43 +02:00
savask
22805e14f1
Tidy up some conditionals in simulation code. (#854) 2022-08-13 18:40:26 +02:00
Rebmiami
ae32470c9c
Make QRTZ slightly change color while growing (#852) 2022-08-11 06:20:33 +02:00
Tamás Bálint Misius
8763d6e75f
Expose SDL button codes to Lua
Also sanitize GameController mouse up reason and related code.
2022-08-08 09:13:05 +02:00
Tamás Bálint Misius
059697aba0
Alias dcolor, pavg0, pavg1 to dcolour, tmp3, tmp4 2022-08-08 08:55:32 +02:00
Tamás Bálint Misius
140531aa88
Add PowderCoin icon to font
We're not currently planning to do anything with this new icon, it's merely a reminder of That One Event, see https://powdertoy.co.uk/Discussions/Thread/View.html?Thread=24651

... or are we? :O

Also remove thermometer placeholders.
2022-08-08 06:49:37 +02:00
Tamás Bálint Misius
4b0fa65bcd
Don't expose KMOD_SCROLL, apparently it's too new 2022-08-01 09:55:23 +02:00
Tamás Bálint Misius
21438d435d
Expose SDL keycodes and scancodes to Lua 2022-08-01 09:44:42 +02:00
Tamás Bálint Misius
c140b4bff0
Fix non-future-proof android NDK path resolution 2022-07-31 08:20:03 +02:00
catsoften
6aa68adbf4
Add custom gravity mode and replace hardcoded gravity interactions (#820)
Co-authored-by: Tamás Bálint Misius <lbphacker@gmail.com>
2022-07-31 08:19:16 +02:00
jacob1
a0016a2b9c
Fix exception when passing nil to some functions in interface api, fixes #849 2022-07-20 21:52:03 -04:00
Tamás Bálint Misius
c603c41b92
Fix PIPE graphics hack giving Lua graphics functions bad particle IDs 2022-07-16 13:27:28 +02:00
Tamás Bálint Misius
ae253ebc75
Add real v parameter to sim.partCreate
Currently it detects presence of v incorrectly (via if (ID(type))) and thus rewrites v = 0 to v = -1, even if 0 is actually what you want. Especially problematic if you're trying to spawn GOL (so LIFE(ctype=0)).
2022-07-06 11:34:21 +02:00
Tamás Bálint Misius
766ffd4ad6
Add sim.partExists and elem.exists 2022-07-03 15:40:35 +02:00
Tamás Bálint Misius
289c2c4528
Fix handling of malformed scale: and proxy: arguments 2022-06-13 13:40:41 +02:00
jacob1
833973f1fc
Mark saves with GLAS/QRTZ/TUNG as 97.0-only
They immediately break if under pressure in older versions, because pavg1 (tmp4) isn't set
2022-06-13 00:53:06 -04:00
jacob1
79f6fd728c
Fix, Deprecate, Remove, and Replace tpt.element_func / tpt.graphics_func 2022-06-04 22:16:45 -04:00
Tamás Bálint Misius
fb7132a923
Fix LITH conducting through INSL 2022-05-27 06:22:22 +02:00
Tamás Bálint Misius
fb318c71ec
Fix a missing #include 2022-05-26 17:53:45 +02:00
Tamás Bálint Misius
c7e9706295
Let NEUT pass through BGLA
GLAS does this, there's no reason for BGLA to not do it also.
2022-05-10 14:27:45 +02:00
jacob1
c8c0f90871
Use date in screenshot filenames to ensure each screenshot's filename is unique 2022-05-06 01:27:33 -04:00
Cracker1000
23af1042b4
Make PHOT change its wavelength upon colliding with charged LITH (#841)
Co-authored-by: Tamás Bálint Misius <lbphacker@gmail.com>
2022-05-04 22:34:23 +02:00
jacob1
f70f222a61
Remove inaccuracy in OIL's description 2022-05-02 11:34:33 -04:00
Tamás Bálint Misius
b278eb4393
New WTRV + BCOL -> OIL reaction in presence of PTNM
Yes, Factorio is a good game.
2022-05-02 06:14:49 +02:00
Tamás Bálint Misius
20bdee33e2
Fix starcatcher-publish step so it actually uploads apks now 2022-04-19 06:25:24 +02:00
Cracker1000
823ff9080e Remove unnecessary .life change from PSNS 2022-04-18 14:39:11 -04:00
Tamás Bálint Misius
f7527b46e6
Update tpt-libs, add support for android 2022-04-14 21:18:21 +02:00