Commit graph

178 commits

Author SHA1 Message Date
github-actions[bot]
0eb44ce943 Merge remote-tracking branch 'origin/master' into new_im_hooks-rollup 2024-04-09 22:33:38 +00:00
Soreepeong
7f5ef03917 Use EarlyLoadedService for anything that is not mandatory for kicking off plugin loader 2024-04-07 21:53:23 +09:00
Soreepeong
50f74c55a7 Merge branch 'master' into new_im_hooks 2024-03-21 00:39:26 +09:00
srkizer
87b9edb448
Add IInternal/PublicDisposableService (#1696)
* Add IInternal/PublicDisposableService

Plugins are exposed interfaces that are not inherited from
`IDisposable`, but services implementing plugin interfaces often
implement `IDisposable`. Some plugins may try to call
`IDisposable.Dispose` on everything provided, and it also is possible to
use `using` clause too eagerly while working on Dalamud itself, such as
writing `using var smth = await Service<SomeService>.GetAsync();`. Such
behaviors often lead to a difficult-to-debug errors, and making those
services either not an `IDisposable` or making `IDisposable.Dispose` do
nothing if the object has been loaded would prevent such errors. As
`ServiceManager` must be the only class dealing with construction and
disposal of services, `IInternalDisposableService` has been added to
limit who can dispose the object. `IPublicDisposableService` also has
been added to classes that can be constructed and accessed directly by
plugins; for those, `Dispose` will be ignored if the instance is a
service instance, and only `DisposeService` will respond.

In addition, `DalamudPluginInterface` and `UiBuilder` also have been
changed so that their `IDisposable.Dispose` no longer respond, and
instead, internal functions have been added to only allow disposal from
Dalamud.

* Cleanup

* Postmerge fixes

* More explanation on RunOnFrameworkThread(ClearHooks)

* Mark ReliableFileStorage public ctor obsolete

---------

Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
2024-03-16 15:58:05 +00:00
Soreepeong
033a57d19d Merge remote-tracking branch 'upstream/master' into feature/inotificationmanager 2024-03-14 13:06:04 +09:00
Soreepeong
9724e511e9 Add INotification.RespectUiHidden 2024-03-14 13:05:46 +09:00
Soreepeong
c326537f9f test 2024-03-07 00:37:46 +09:00
Soreepeong
7aba15ef5b Normalize namespaces 2024-02-28 17:11:29 +09:00
Soreepeong
f6be80a5fb Make IDalamudTextureWrap ICloneable 2024-02-25 21:21:50 +09:00
srkizer
34daa73612
Implement FontChooserDialog (#1637)
* Implement FontChooserDialog

* Minor fixes

* Fixes 2

* Add Reset default font button

* Add failsafe

* reduce uninteresting exception message

* Add remarks to use AttachExtraGlyphsForDalamudLanguage

* Support advanced font configuration options

* fixes

* Shift ui elements

* more fixes

* Add To(Localized)String for IFontSpec

* Untie GlobalFontScale from default font size

* Layout fixes

* Make UiBuilder.DefaultFontSize point to user configured value

* Update example for NewDelegateFontHandle

* Font interfaces: write notes on not intended for plugins to implement

* Update default gamma to 1.7 to match closer to prev behavior (1.4**2)

* Fix console window layout
2024-02-13 20:09:46 +00:00
Soreepeong
5161053cb3 Move IFontHandle.ImFontLocked to ILockedImFont+impl 2024-01-24 00:19:27 +09:00
Soreepeong
68dc16803c Turn ImFontLocked into a class
As `ImFontLocked` utilizes a reference counter, changed it to a class so that at worst case we still got the destructor to decrease the reference count.
2024-01-23 23:50:17 +09:00
Soreepeong
871deca6e9 Remove PostPromotion event
`PostPromotion` is removed, as `IFontHandle.ImFontChanged` now does the job. It also removes the possibility that resources may get disposed while post promotion callback is in progress.

* `IFontHandle.ImFontChanged` is now called with a locked instance of the font.
* `IFontHandle.ImFontLocked`: Added `NewRef` to increase reference count.
2024-01-23 23:49:57 +09:00
Soreepeong
fb8beb9370 Move PostPromotion modification functions to PostBuild
These changes are done to ensure that `IFontHandle.Lock` will be guaranteed to obtain a fully built font that will not be modified any further (unless `PostPromotion` is being used for modifying fonts, which should not be done by clients.)

* Moved `CopyGlyphsAcrossFonts` and `BuildLookupTable` from `PostPromotion` to `PostBuild` build toolkit.
* `IFontAtlasBuildToolkit`: Added `GetFont` to enable retrieving font corresponding to a handle being built.
* `InterfaceManager`: Use `OnPostBuild` for copying glyphs from Mono to Default.
* `FontAtlasBuildStep`:
    * Removed `Invalid` to prevent an unnecessary switch-case warnings.
    * Added contracts on when `IFontAtlas.BuildStepChanged` will be called.
2024-01-23 23:49:47 +09:00
Soreepeong
5479149e79 Lock font resources on Push and miscellaneous direct accesses
These changes ensure that using a font under some other thread's ownership from the UI thread for rendering into ImGui purposes always work.

* `FontHandle`:
    * Moved common code from `DelegateFontHandle` and `GamePrebakedFontHandle`.
    * Added `LockUntilPostFrame` so that the obtained `ImFontPtr` and its accompanying resources are kept valid until everything is rendered.
    * Added more code comments to `Try/Lock`.
    * Moved font access thread checking logic from `InterfaceManager` to `LockUntilPostFrame`.
    * `Push`ing a font will now also perform `LockUntilPostFrame`.
* `GameFontHandle`: Make the property `ImFont` a forwarder to `FontHandle.LockUntilPostFrame`.
* `InterfaceManager`:
    * Added companion logic to `FontHandle.LockUntilPostFrame`.
    * Accessing default/icon/mono fonts will forward to `FontHandle.LockUntilPostFrame`.
    * Changed `List<T>` to `ConcurrentBag<T>` as texture disposal can be done outside the main thread, and a race condition is possible.
2024-01-23 23:49:34 +09:00
Soreepeong
29b3e0aa97 Make IFontHandle.Push return IDisposable, and add IFontHandle.Pop 2024-01-21 13:15:36 +09:00
Soreepeong
3e3297f7a8 Use Lock instead of .ImFont 2024-01-21 04:49:51 +09:00
Soreepeong
967ae97308 Expose wrapped default font handle 2024-01-21 03:41:26 +09:00
Soreepeong
1a19cbf277 Set ImGui default font upon default font atlas update 2024-01-20 10:21:50 +09:00
Soreepeong
ad12045c86 Fix notifications font 2024-01-19 08:31:08 +09:00
Soreepeong
63b16bcc7c Reapply "IFontAtlas: font atlas per plugin"
This reverts commit b5696afe94.
2024-01-19 07:26:56 +09:00
goat
b5696afe94 Revert "IFontAtlas: font atlas per plugin" 2024-01-18 12:51:58 -08:00
Soreepeong
015c313c5e Move UseAxis/Override to FAF 2024-01-03 23:45:46 +09:00
Soreepeong
e7c7cdaa29 Update docs and exposed API 2024-01-03 23:37:00 +09:00
Soreepeong
e86c5458a2 Remove font gamma configuration 2024-01-03 23:37:00 +09:00
Soreepeong
f8e6df1172 Add font build status display to Settings window 2024-01-03 23:36:59 +09:00
Soreepeong
8bdab4d2c8 Implement DalamudFontAtlas 2024-01-03 23:36:08 +09:00
Soreepeong
0afb3d2c8a Better WndProc handling 2023-12-17 13:59:47 +09:00
Soreepeong
b910ebc014 Auto-enable fonts depending on the character input 2023-12-17 11:59:11 +09:00
Soreepeong
b6d88f798a Make CJK imes work better 2023-12-17 11:59:11 +09:00
Soreepeong
8967174cd9 Reimplement clipboard text normalizer to use the correct buffers 2023-12-08 23:28:12 +09:00
grittyfrog
496bed4c69
Fix multi-line copy/paste between ImGui and XIV (#1525) 2023-12-08 00:30:11 +01:00
srkizer
a0f4baf8fa
Less footguns in service dependency handling (#1560) 2023-12-06 21:29:46 -08:00
Soreepeong
a72f407357 Add DalamudAssetManager 2023-11-28 22:31:46 +01:00
srkizer
b66be84b93
Better Service dependency handling (#1535) 2023-11-28 22:20:16 +01:00
srkizer
7a0de45f87
Miscellaneous improvements (#1537) 2023-11-26 22:58:26 +01:00
srkizer
f60e7b7a86
Fulfill BuildLookupTable preconditions (#1507) 2023-10-29 11:38:31 +01:00
goat
9875a7ea31
feat: allow configuring the default page the installer opens to 2023-10-25 17:32:42 +02:00
goat
2bdb837577
feat: enable early loaded services to wait for provided services, some rewrites to make service kind declaration more explicit 2023-10-01 21:12:27 +02:00
goat
f44c6794e7
chore: tidy-up, move files shared between dalamud and injector into separate assembly 2023-09-30 16:11:52 +02:00
goat
ebabb7bd04
chore: make SigScanner public, have separate service TargetSigScanner that resolves via ISigScanner (closes #1426) 2023-09-24 01:49:34 +02:00
goat
6fbcd0e0e4
chore: don't use ImGuiScene.TextureWrap for any external API, IDalamudTextureWrap does not inherit from ImGuiScene.TextureWrap any longer 2023-09-23 13:05:19 +02:00
github-actions[bot]
b384216d9d Merge remote-tracking branch 'origin/master' into v9-rollup 2023-09-19 21:15:29 +00:00
goat
9b31a7ff39
Merge pull request #1407 from Soreepeong/fix/noto-glyph-ranges 2023-09-19 19:29:17 +02:00
Soreepeong
84c5982c25 Use axis12 glyph ranges when loading noto12 as Dalamud default font 2023-09-19 15:17:15 +09:00
goat
b241ffe008
Merge branch 'new_im_hooks' into feature/object-vtable-hook-with-swapchain 2023-08-13 23:14:51 +02:00
goat
ebc4baca58
fix: return DalamudTextureWrap from LoadImageFromDxgiFormat(), cast explicitly 2023-08-08 21:36:46 +02:00
goat
02e1f2502e
refactor: move Dalamud.Interface utils into main assembly, warnings pass 2023-08-04 19:36:09 +02:00
goat
758ae7c097
Remove texture-related IDataManager functions 2023-08-03 20:33:04 +02:00
goat
933eb9fa96
merge 2023-08-03 12:52:44 +02:00