Commit graph

141 commits

Author SHA1 Message Date
Andrei Alexeyev
021584a83b
emscripten: redesign shell, always use whole window for game canvas 2024-10-24 01:08:32 +02:00
Andrei Alexeyev
48568b9227
renderer: add r_unclaim_window API
Must be called before destroying a window. Implementation is optional.
2024-08-30 11:52:47 +02:00
Andrei Alexeyev
8b37d1cbf2
src: the great #include massacre of 2024 2024-05-17 14:11:48 +02:00
Andrei Alexeyev
be7905d6a3
src: run upkeep 2024-05-17 04:58:47 +02:00
Andrei Alexeyev
4986c89680
cli,video: add --width and --height arguments to set initial window size 2024-05-02 00:24:06 +02:00
Andrei Alexeyev
783172861a
renderer: simplify async readback API; use glMapBufferRange
glGetBufferSubData is not available on GLES
2024-05-01 00:19:07 +02:00
Andrei Alexeyev
d03b2eb38c
video: add "framedump" mode; use async readback for screenshots;
The framedump mode captures every frame and saves it as a .png image.
This can be useful for rendering videos.

To activate, set the `TAISEI_FRAMEDUMP` environment variable to a
prefix. A 8-digit frame number followed by ".png" will be appended to
this string to form the filename of each frame.

Example:
	$ mkdir /var/tmp/taisei
	$ export TAISEI_FRAMEDUMP="/var/tmp/taisei/frame-"
	$ taisei -f1 -r /foo/some-replay.tsr
	$ ls /var/tmp/taisei
	frame-00000000.png  frame-00000001.png frame-00000002.png
	...

`TAISEI_FRAMEDUMP_SOURCE` can be set to either "screen" or "viewport".
The default is "screen", which records the whole game screen as it
appears (minus the letterboxing borders). "viewport" makes it record the
stage viewport only. The image is taken directly from the viewport
framebuffer, so elements that are drawn over the viewport will be
missing, such as the dialogue or the pause menu.

`TAISEI_FRAMEDUMP_COMPRESSION` can be set to change the quality of zlib
compression of the png images, ranging from 0 to 9. The default is 1.

Additionally, it's now possible to take screenshots of the game viewport
by pressing Alt+P (by default). This works on the same principle as
`TAISEI_FRAMEDUMP_SOURCE=viewport`, so the same caveats apply. This can
be used to take a clean screenshot of the viewport while the game is
paused.
2024-04-29 01:15:15 +02:00
Andrei Alexeyev
11090983b7
video: shut down the renderer before destroying the window 2024-04-29 01:15:15 +02:00
p-sam
fda783ed2c
switch: use native screen resolution 2023-11-29 13:21:47 +01:00
Andrei Alexeyev
c15934f666
dynarray: get rid of memset and add optional initializer arg to dynarray_append 2023-09-28 17:43:14 +02:00
Andrei Alexeyev
bd361067df
headers: isolate endings, remove stage.h inc. from plrmodes.h, fix resulting mess 2023-07-30 06:16:17 +02:00
Andrei Alexeyev
9564c20ed9
video: retarded broken-ass braindead piece of shit garbage 2023-06-23 10:58:28 +02:00
Andrei Alexeyev
f8adda39be
video: update scaling factor after resize
On wayland the scaling factor doesn't seem to be initialized correctly,
as we get a different framebuffer size from what was requested
initially, followed by a resize event with the correct size.
2023-06-23 10:58:28 +02:00
Andrei Alexeyev
ee2bb877bc
global: basic kiosk mode support 2023-06-20 01:13:50 +02:00
Andrei Alexeyev
f99ea11bd2
video: attempt to enforce ALWAYS/NEVER capabilities 2023-06-20 01:13:50 +02:00
Andrei Alexeyev
eeb99858ca
video: make video_get_mode() safer 2023-06-20 01:13:50 +02:00
Andrei Alexeyev
3dc0faec9e
renderer/api: rename ClearBufferFlags to BufferKindFlags 2023-04-10 06:47:55 +02:00
Andrei Alexeyev
0c533c2a7d
video: debug log SDL_WINDOWEVENT_SIZE_CHANGED events 2023-02-23 01:49:57 +01:00
Andrei Alexeyev
baf5c9be60
video: env variables to control when to recreate window
TAISEI_VIDEO_RECREATE_ON_RESIZE=1 to recreate window when changing size
(e.g. in the options menu). Enabled by default on X11 and Emscripten.
Doesn't apply when toggling fullscreen mode.

TAISEI_VIDEO_RECREATE_ON_FULLSCREEN=1 to recreate window when toggling
fullscreen mode on/off. Enabled by default on X11.
2023-02-23 01:49:57 +01:00
Andrei Alexeyev
f6bf2e451b
video: fix external fullscreen toggle event handling 2023-02-23 01:49:57 +01:00
Andrei Alexeyev
12af051d48
video: don't hide cursor in windowed mode 2023-01-27 23:44:29 +01:00
Andrei Alexeyev
b6978178b1
memory: use custom memory allocation wrappers
Introduces wrappers around memory allocation functions in `memory.h`
that should be used instead of the standard C ones.

These never return NULL and, with the exception of `mem_realloc()`,
zero-initialize the allocated memory like `calloc()` does.

All allocations made with the memory.h API must be deallocated with
`mem_free()`. Although standard `free()` will work on some platforms,
it's not portable (currently it won't work on Windows). Likewise,
`mem_free()` must not be used to free foreign allocations.

The standard C allocation functions are now diagnosed as deprecated.
They are, however, available with the `libc_` prefix in case interfacing
with foreign APIs is required. So far they are only used to implement
`memory.h`.

Perhaps the most important change is the introduction of the `ALLOC()`,
`ALLOC_ARRAY()`, and `ALLOC_FLEX()` macros. They take a type as a
parameter, and allocate enough memory with the correct alignment for
that type. That includes overaligned types as well. In most
circumstances you should prefer to use these macros. See the `memory.h`
header for some usage examples.
2023-01-18 13:23:22 +01:00
Andrei Alexeyev
b4e07470d8
pixmap: refactor
* Split conversion-related code into a separate file.
* Renamed loaders to fileformat handlers.
* Added API for exporting into one of the supported file formats.
* Replaced serialization APIs with an "internal" fileformat capable of
  of storing any Pixmap. It is identical to the serialization format.
* Removed PNG writing code from video_screenshot_task, now using the new
  pixmap export API instead.
2021-07-18 18:27:38 +03:00
Andrei Alexeyev
efdaf51928
stage3d: add free camera control tool for debugging 2021-07-09 22:56:07 +03:00
Andrei Alexeyev
173c8c3cc6
replay: general refactor
* Split replay.c into multiple files under replay/; improve logical
  separation of replay-related code.
* Separate replay playback state from data.
* Get rid of global static replay struct and avoid unnecessary replay
  copying.
* Replay playback and recording are now independent and may occur
  simultaneously, although this functionality is not yet exposed. This
  enables replay "re-recording" while synthesizing new desync check
  events, possibly at a different rate from the original replay.
* Rate of recorded desync check events can now be controlled with the
  TAISEI_REPLAY_DESYNC_CHECK_FREQUENCY environment variable. The default
  value is 300 as before.
* Probably other stuff I forgot about.
2021-06-16 01:43:10 +03:00
Andrei Alexeyev
c5bd04128b
video: more sensible step size for windowed mode list generation
Previously scaling_factor would skip past 1.0, which is what our assets
are actually optimized for...
2021-04-13 20:26:23 +03:00
Samuel P
0600ebaea6
video: don't create windowed-mode windows under fullscreen-only drivers (#246) 2020-08-16 21:16:01 +03:00
Andrei Alexeyev
f9a186455f
Fix float zero division in video init 2020-08-15 18:42:18 +03:00
Andrei Alexeyev
f12fc3db0f
fix global postprocessing framebuffers not reacting to resizes 2020-04-24 00:11:54 +03:00
Andrei Alexeyev
b3ce65d5ac
Improve high-DPI handling (#213)
SDL_WINDOW_ALLOW_HIGHDPI is now used. On platforms where SDL supports
this flag, the window size units are interpreted as abstract scaled
points rather than raw pixels, and may not match the underlying
framebuffer resolution if the display scaling factor is not 1. The
scaling factor and the effective framebuffer resolution are now
displayed in the options menu to reflect this fact.

In addition, the hidden "fullscreen_desktop_mode" setting has been
removed and the behavior is now always as if the value was "1" (the
default). Exclusive fullscreen with modesetting is not very useful,
and does not work well on some platforms (X11 in particular). That code
is not worth maintaining together with the frankly ridiculous complexity
of dancing around with the DPI scaling shenanigans of various operating
systems.

On platforms that do not support SDL_WINDOW_ALLOW_HIGHDPI, the window
size is assumed to correspond to raw pixels, and an effort is made to
disable the operating system's DPI upscaling mechanism, when possible.

This commit also fixes the Windows manifest, broken by
dc57f78d89 thanks to microshaft's amazing
documentation.

Closes #211
2020-04-16 19:25:54 +03:00
Andrei Alexeyev
0cbc86c66e
Add generic type-safe facility for dynamic arrays (#207)
Replace most ad-hoc opencoded dynamic arrays across the codebase
2020-04-05 05:51:00 +03:00
Andrei Alexeyev
07b6e0950c
Add r_framebuffer_get_size; abstract away SDL_GL_GetDrawableSize 2020-03-30 01:41:29 +03:00
Andrei Alexeyev
c5b28b2b15
Determine window size options dynamically 2020-03-30 00:47:07 +03:00
Alice D
77246397c3
Video resolution improvements/high-DPI quirks (#204) 2020-03-30 00:03:38 +03:00
Andrei Alexeyev
5d4155514e
fix debug overlay not drawn when global postprocessing is active 2019-12-05 22:13:38 +02:00
Andrei Alexeyev
9d3bf87559
Refactor matrix stack API to get rid of matrix mode (#177)
This replaces the r_mat_foo functions with specialized r_mat_{mv,tex,proj}_foo counterparts that operate explicitly on the modelview, texture, and projection matrix stacks respectively.
2019-10-12 15:02:15 +03:00
Andrei Alexeyev
7fe3f8ff90
windows: detect intel's shitty driver and fall back to ANGLE 2019-09-21 16:46:22 +03:00
Andrei Alexeyev
1bd0d49e70
video: don't try to init unavailable drivers 2019-09-15 12:58:00 +03:00
Andrei Alexeyev
55b835ebdc
video: fix fallback to default SDL driver selection 2019-09-15 12:52:24 +03:00
Andrei Alexeyev
a84f7c8629
fix video viewport not being updated after leaving fullscreen 2019-09-11 19:19:44 +03:00
Andrei Alexeyev
28ba4dc955
Make video struct private
Also display actual window size in settings when no known mode is
selected
2019-09-11 18:42:13 +03:00
Andrei Alexeyev
2e9904e83c
New system to manage auto-resized framebuffers 2019-08-25 02:52:39 +03:00
Samuel P
11f3b6701e Switch SDL video modes detection (#174)
* Use SDL driver and video modes detection on Switch

* Don't add windowed modes if always fullscreen
2019-08-17 08:58:55 +03:00
Andrei Alexeyev
b88fc4ad2e
Support full-screen custom postprocessing
Works just like the viewport one, except the configuration goes in
shaders/global.pp instead. The player uniforms aren't available.
2019-08-09 21:42:04 +03:00
Andrei Alexeyev
5a23fb95fc
make upkeep script preserve existing copyrights 2019-08-03 20:44:22 +03:00
Samuel P
469d6e2f48 Switch homebrew port (#173)
* Initial port

* Switch specific video modes

* Handle clean exit

* Hide option to disable gamepads, force it enabled

* Match buttons layout with Switch controllers

* Hide player name setting (to avoid getting stuck)

* Switch specific VFS setup instead of env bootstrap

* Clean up, get rid of warnings and a few ifdefs

* Add Switch specific build script and assets

* Make vfs setup mount packages

* Re-enable packaging on Switch

* Transpile shaders to es and install them

* Add applet warning and shader deps to README

* Remove script; instead using meson build scripts

* Strict prototypes

* Build script compat with project minimum meson ver

Refactor of pack.py exclude option

* Uniformise header inclusion on arch_switch.c

* Allow input for any dev; hide the option on Switch

* Silence unsused function warnings
2019-08-02 21:38:33 +03:00
Andrei Alexeyev
3055901998
update my email 2019-07-03 21:00:56 +03:00
Andrei Alexeyev
4c0359ecbe
gl33: make the stupid framebuffer swap hack slightly more correct 2019-05-11 21:20:38 +03:00
Andrei Alexeyev
58b964baba
add display option for multi-monitor systems 2019-04-18 22:56:16 +03:00
Andrei Alexeyev
7f8b72d864
video: don't lose resizability after toggling fullscreen 2019-04-18 20:16:56 +03:00