Commit Graph

60 Commits

Author SHA1 Message Date
Lephe 28bea2e1ce
gint: switch from file filters to config macros + basic fxg3a target
Nothing interesting in this commit, just moving files around, making
sure every target compiles every file, and controlling with macros
instead.

Basic support for fxg3a target in CMakeLists.txt, cmake/FindGint.cmake,
giteapc.make and include/gint/config.h.in. The rest is forgettable.
2024-03-23 10:02:51 +01:00
Lephe 16259deb20
render: expose some internal text rendering utilities 2023-06-04 23:24:34 +02:00
Lephe 6f758cd36c
defs: allow NULL callbacks in gint_call() 2023-01-31 16:04:35 +01:00
Lephe db50c9b192
kernel: more options in System ERROR screen
* Add options to RESET, go to menu, or abort()
* Define weak symbols for driver functions so that low-level debugging
  add-ins can be linked with minimal drivers (CPU/INTC/MMU)
2023-01-25 22:38:39 +01:00
Lephe e2c507855f
render-cg: allocate VRAM in _ostk to keep _uram for large allocs 2022-11-26 18:38:09 +01:00
Lephe 8442e0b9cf
render: fix missed clipping test in dtext() 2022-11-19 23:41:47 +01:00
Lephe 4df3d69d8c
render: add a window setting to restrict rendering
Mono text rendering is a bad hack and probably not that fast, but meh.
We can optimize it the day it becomes a bottleneck, if ever...
2022-11-19 17:19:28 +01:00
Lephe 74438f5da5
render: add a dgetpixel() function 2022-11-16 19:12:48 +01:00
Lephe 45fa6c87c2
render-cg: fix a bug with unaligned C_INVERT drect()
The alignment optimization would write the edges twice, which is fine
for opaque color fills, but cancels out for C_INVERT.
2022-11-16 18:10:22 +01:00
Lephe fc6f7d3051
image: remove alpha field of images 2022-05-14 12:54:59 +01:00
Lephe 5a69e44078
image: new image format and base for the image library 2022-05-13 23:31:03 +01:00
Lephe 7822899b1f
render-cg: fix incorrect margin size for VRAMs 2022-05-07 18:22:38 +01:00
Lephe d2f788a3fc
render-cg: fix negative alpha values being miscompared in P8 2022-05-07 18:12:44 +01:00
Lephe 667f43b45c
render-cg: remove now-unused section of .effects field of image command 2022-05-06 16:52:05 +01:00
Lephe ede19fc878
render-cg: restore bopti method on P4 and defined p4_clearbg_alt 2022-05-06 16:26:44 +01:00
Lephe a4df076214
render-cg: replace dimage and dsubimage with new renderer 2022-05-04 20:53:56 +01:00
Lephe 7a3604ccbb
render-cg: allocate VRAM in the heap; default to double buffering
* Create a heap arena over the OS stack, large enough to hold two VRAMs
  as was previously done, unless GINT_NO_OS_STACK is set at compile
  time. (This replaces GINT_USER_VRAM.)

* Allocate a single VRAM in the heap at startup.

* Use double buffering by default as triple buffering is almost entirely
  useless. dudpate() waits if both VRAMs are identical to prevent
  corruption, but this can be bypassed with R61524 functions as usual.
  This adds about 180 kB of heap data to any add-in using default
  settings.
2022-05-04 20:08:52 +01:00
Lephe f219e5c882
render-cg: add new image rendering functions with dynamic effects 2022-05-04 19:08:54 +01:00
Lephe 26c5b76037
render-cg: round RGB16 images to even widths 2022-05-04 17:17:18 +01:00
Lephe 36d66a6317
bopti: fix p4 stride omission from 1384c54b5 2022-01-18 13:50:04 +01:00
Lephe 1384c54b5f
render-cg: update to bopti formats for Azur 2021-09-28 09:55:26 +02:00
Lephe 192ff17303
render-cg: fix an incorrect x bound on vertical lines 2021-09-05 17:55:29 +02:00
Lephe d3a2cf07a0
usb: add video capture through the fxlink protocol 2021-08-11 01:43:26 +02:00
Lephe 8e730c2f78
replace gint/std headers with standard ones 2021-06-08 11:01:27 +02:00
Lephe a9f6c4b622
display-cg: fix a bug in bopti r5g6b6 for very thin images 2021-06-02 11:22:29 +02:00
Lephe 7b40e1e0d0
display: fix a bad overflow for empty lines due to clipping 2021-05-30 23:46:11 +02:00
Lephe 99403a9504
render: support C_INVERT on fx-CG 50 2021-05-12 09:17:25 +02:00
Lephe a086510885
display: add a maximum size parameter to dtext_opt()
This parameter controls the maximum number of glyphs to print.

For backwards compatibility, it is automatically inserted by a macro in
older calls with only 7 parameters.
2021-02-15 18:37:06 +01:00
Lephe 293532024d
kernel: fix gint[HWURAM] not being set on fx-9860G
When switching to dynamic TLB the counting of mapped memory was no
longer required at boot time. This was restored weirdly for fx-CG 50 and
not at all for fx-9860G; this is now fixed.
2021-02-02 18:18:02 +01:00
Lephe 8157f4b2ab
cmake: restore options USER_VRAM and STATIC_GRAY 2021-01-25 19:06:42 +01:00
Lephe 3a15340335
topti: improve text positioning
* Specify a line height for the default fx-CG 50 font so that the height
  returned by dsize() is correctly 9, not 11.
* Adjust vertical and horizontal alignment in dtext_opt() and
  dprint_opt() by a full pixel (DTEXT_BOTTOM, DTEXT_RIGHT) and half a
  pixel (DTEXT_MIDDLE, DTEXT_CENTER) to make sure that the specified
  position is within rendered text (as in DTEXT_LEFT and TEXT_TOP) and
  to improve centering of strings with odd width or odd height, for
  which there is only one valid position.
2020-10-21 11:49:12 +02:00
Lephe 240f29f9d5
topti: custom character and word spacing (#13)
This commit introduces custom character spacing with a new fxconv
parameter "char-spacing". Word spacing is also tied to the width of the
space character (0x20). This removes the need for special semantics on
the space character, but requires that its size be specified with gray
pixels for proportional fonts.

This also fixes problems with the size of spaces in dsize() not being
correlated with their size during rendering, since on fx-9860G topti
already used the glyph's with as word spacing.

Since fxconv changes but gint's Makefile does not track updates to
external tools, a full rebuild of gint is required past this commit.
2020-10-05 16:14:12 +02:00
Lephe e16f3acfa1
topti: support Unicode fonts
This change adds UTF-8 decoding to dtext() to fully use Unicode fonts
provided by fxconv.
2020-07-14 15:28:46 +02:00
Lephe e3042755d2
topti: support Unicode in the data structures (WIP)
This change modifies the font_t type to replace the concept of charset
with a more generic list of non-overlapping Unicode blocks defined by a
starting code point and a size.

It also takes advantage of the assembly feature of fxconv, introduced
for libimg long after the first version of topti, to support pointers in
the converted structure rather than having to tediously compute offsets
within a variable-size structure.
2020-07-14 12:11:12 +02:00
Lephe 77de9e7796
move private headers to subfolders of src/
This keeps the include/ folder clean.
2020-07-13 17:47:21 +02:00
Lephe 94fb300e72
gray: finalize the gray engine API
* Define dgray() to replace gray_start() and gray_stop()
* Introduce a mechanism to override the d*() functions rather than using
  another set of functions, namely g*(). Gray rendering should now be
  done with d*() (a compatibility macro for g*() is available until v2.1).
* Gray engine now reserves TMU0 at the start of the add-in to prevent
  surprises if timers are exhausted, so it nevers fails to start
* Replace other gray engine functions with dgray_*()
* More general rendering functions (in render/) to lessen the burden of
  porting them to the gray engine. As a consequence, dtext_opt(),
  dprint_opt() and drect_border() are now available in the gray engine,
  which was an omission from 230b796.
* Allow C_NONE in more functions, mainly on fx-CG 50
* Remove the now-unused dupdate_noint()
2020-07-13 13:49:07 +02:00
Lephe 7d63a1b536
r61524 render-cg: support Prizm and fx-CG Manager
This change adds a new HWCALC model, HWCALC_FXCG_MANAGER, which
identifies Casio's official fx-CG Manager software. Both the Prizm and,
to my surprise, the fx-CG Manager use the old RAM address of 88000000
(P1) and a8000000 (P2) instead of the new fx-CG 50 address of 8c000000
(P1) and ac000000 (P2).

The VRAM is hence adjusted at startup to move hardcoded pointers into
the proper space. Added to the kernel moving the VBR space dynamically
on the Prizm, this allows gint to be fully compatible with these
platforms.

The fx-CG Manager is detected by its product ID made of 0xff.

Also adds a proper interface to the R61524 driver, even though it's not
any more complete than previously, and fixes an oversight where the
HWURAM entry of the kernel data array was no longer computed since the
TLB management change.

As of now, the fx-CG Manager still has a bug regarding return-to-menu
since returning from the main menu doesn't work very well and often
loops. This has been seen occasionally on some Graph 90+E so it's
unlikely to be a platform-specific problem.
2020-07-02 15:48:19 +02:00
Lephe ed30b2cb21
render-cg: allow VRAM in user stack
This is currently unused and has some artifacts in gintctl for reasons I
haven't understood yet. Will have to investigate later.
2020-07-02 15:47:11 +02:00
Lephe b7de559b78
some cleanup in src/core and in the repository 2020-06-20 11:41:13 +02:00
Lephe 230b796196
render: add alignment options to dtext_opt() and dprint_opt()
This change introduces two new functions dtext_opt() and dprint_opt()
that have both color and alignment options. The regular dtext() and
dprint() have been changed to always used bg=C_NONE which is what most
calls want.
2020-06-18 18:31:13 +02:00
Lephe d8886c7dbf
core: answer TLB misses and remove startup mapping (UNSTABLE)
This change adds a TLB miss handler that calls __TLB_LoadPTEH() and
removes the startu mapping of add-in pages in the explore() routine of
src/core/start.c.

Note that calling __TLB_LoadPTEH() manually might unexpectedly lead to a
TLB multihit problem as the requested page might be accidentally loaded
by a TLB miss in the code that loads it. A TLB multihit is a platform
reset, so this function should always be considered unsafe to call
(unless the calling code is in a combination of P1 space and ILRAM).

This change also moves a lot of functions out of the .pretext section,
notably topti, as this was designed to allow panic messages when the
add-in couldn't be mapped entirely. By contrast, a GMAPPED macro has
been defined to mark crucial kernel code and data that must remain
mapped at all times. This currently puts the data in ILRAM because
static RAM is not executable. An alternative will have to be found for
SH3-based fx9860g machines.

This version still does not allow TLB misses in timer callbacks and
breaks return-to-menu in a severe way! It is not suitable for any
stable application!
2020-06-14 18:22:20 +02:00
Lephe 610362f8c9
render-cg: fix potential VRAM overflow in gint_dhline()
A missing coordinate check in gint_dhline() would allow lines entirely
out of bounds of the screen to write pixels outside of their expected
range, often wrapping up to the next line, but possibly overflowing from
VRAM.
2020-06-13 20:41:13 +02:00
Lephe caa4f675c9
bopti: deprecate image_t, renamed to bopti_image_t 2020-06-01 12:11:59 +02:00
Lephe e217309adf
render-cg: expose vram buffers with dgetvram() and dsetvram() 2020-05-10 23:03:02 +02:00
Lephe 61da7debc8
code review and display driver changes
t6k11: use the gint array for variant detection
r61524: use true triple buffering by default
display: define DWIDTH and DHEIGHT
display: add C_RGB(r,g,b) (0 ≤ r,g,b ≤ 31) [fxcg50]
2020-02-23 16:05:25 +01:00
Lephe 3147045196
bopti-cg: add p8, p4, and fix alignment issues on r5g6b5 2019-11-15 13:31:44 +01:00
Lephe 9eb723ee53
render: remove the GINT_NEED_VRAM macro
This macro used to protect the declaration of the [vram] variable of
gint. This variable was short to keep drawing functions short but could
clutter the namespace.

That being said, it's even better to just [#define vram gint_vram] if
you need. This change renames the variable to [gint_vram], exposes it
whenever <gint/display.h> is included, and removes the GINT_NEED_VRAM
macro altogether.
2019-10-27 08:14:42 +01:00
Lephe ef0e5e32f8
render: add one-parameter dvline() and dhline()
Behave like Basic's Horizontal and Vertical commands. Internal dline()
optimizations are renamed gint_dhline() and gint_dvline().

Also supports ghline() and gvline() in the gray engine.

Optimization cases here are amost negligible due to limiting RAM access
frequencies and the very limited amount of work accomplished in the
functions. Code maintainability is prioritized by using dline().
2019-09-07 11:26:11 +02:00
lephe 6d54a5fe0a dma: add exception handler and dma_memset() 2019-08-27 21:18:44 +02:00
lephe 652637d475 bopti: add support for r5g6b5 and r5g6b5a on fxcg50
This commit introduces bopti for fxcg50 with the first basic 16-bit
formats. The performance is rather slow, especially for large images,
and will need refinements and/or overclock to be really efficient in
full-screen real-time applications.
2019-08-27 21:04:07 +02:00