Commit graph

69 commits

Author SHA1 Message Date
goat
98a4c0d4fd
Merge pull request #2479 from goatcorp/api14-rollup
Some checks are pending
Build Dalamud / Build on Windows (push) Waiting to run
Build Dalamud / Check API Compatibility (push) Blocked by required conditions
Build Dalamud / Deploy dalamud-distrib staging (push) Blocked by required conditions
[api14] Rollup changes from master
2025-12-05 18:20:01 +01:00
Haselnussbomber
0112e17fdb
Replace internal SharpDX usage with TerraFX 2025-12-04 23:33:48 +01:00
Soreepeong
c19ea6ace3 Add ITextureProvider.CreateTextureFromSeString 2025-08-05 11:48:02 +09:00
Kaz Wolfe
bd52c60c6f
Merge branch 'imgui-bindings' into api13
# Conflicts:
#	Dalamud/Game/Gui/GameGui.cs
#	Dalamud/Interface/Internal/UiDebug.cs
#	Dalamud/Interface/Internal/Windows/Data/Widgets/AddonWidget.cs
#	Dalamud/Interface/Internal/Windows/SelfTest/Steps/ItemPayloadSelfTestStep.cs
2025-08-04 11:30:14 -07:00
Haselnussbomber
564c220ed2
[Api13] Remove obsoletes (#2323)
* Remove IFate.HasExpBonus

* Remove IAddonEventManager.AddonEventHandler

* Remove obsolete filesystem functions from Util

* Remove more obsoletes
2025-07-26 12:50:42 -07:00
Haselnussbomber
9956424c13
Remove unnecessary IsNull functions 2025-07-17 01:42:20 +02:00
Kaz Wolfe
f63ee5cb76
Merge branch 'master' into imgui-bindings 2025-07-03 19:02:35 -07:00
srkizer
03e728e129
Use EnumerateInvocationList instead of GetInvocationList (#2303) 2025-06-23 22:09:48 +02:00
goaaats
dc83879c89 Texture handle shim 2025-04-14 21:20:39 +02:00
goaaats
ad3b0f0194 Fix some warnings 2025-04-08 22:21:04 +02:00
goaaats
0690cce995 wip bindings upgrade 2025-04-06 20:59:23 +02:00
Soreepeong
3c4b9f96ff Merge remote-tracking branch 'upstream/master' into imguiscene-inside 2024-07-27 23:38:12 +09:00
Soreepeong
1be5cd452d Make all TCS RunContinuationsAsynchronously 2024-07-21 20:49:41 +09:00
Soreepeong
427e5e7c06 cleanup 2024-07-19 18:49:11 +09:00
Soreepeong
184463a056 Rewrite ImGuiScene 2024-07-19 18:48:05 +09:00
goat
1d1b60b011 api10 todo: move IDalamudTextureWrap to Dalamud.Interface.Textures.TextureWraps 2024-06-29 00:45:16 +02:00
Soreepeong
8c7771bf7d Merge branch 'apiX' into feature/itextureprovider-updates 2024-05-12 22:17:32 +09:00
srkizer
bd2c9b2258
Apply most of Api10ToDo (#1782) 2024-04-20 23:25:33 -07:00
rootdarkarchon
e97d95dba8
Add FontAwesome fixed width (#1737)
* Add FA-FW

* remove braces (ask of kizer)

* reuse iconfont glyphs

* use FAFS for initial font

---------

Co-authored-by: rootdarkarchon <root.darkarchon@outlook.com>
2024-04-14 23:19:27 +02:00
Soreepeong
7f5ef03917 Use EarlyLoadedService for anything that is not mandatory for kicking off plugin loader 2024-04-07 21:53:23 +09:00
srkizer
05c943df69
Add FluentGlyphRangeBuilder and AttachWindowsDefaultFont (#1745)
`FluentGlyphRangeBuilder` can build glyph ranges without having to
allocate native ImGui objects, and supports adding `ReadOnlySpan` and
`IEnumerable` of `char`s and `byte`s, `UnicodeRange`s, and known glyph
ranges for select cultures (CJK for now.)

Added `IFontAtlasBuildToolkitPreBuild.AttachWindowsDefaultFont` which
has a predefined list of default Windows fonts per language.
2024-03-29 23:06:10 +01:00
srkizer
e52c2755cb
Fix CreateImGuiRangesFrom to omit null char (#1709)
* Fix CreateImGuiRangesFrom to omit null char

UnicodeRanges.BasicLatin is [0, 127], but ImGui stops reading the glyph
range list on encountering a zero. Fixed that by ensuring that 0 never
appears in the glyph range list.

* Make problems explicit

---------

Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
2024-03-16 16:02:36 +00: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
srkizer
cf4a9e3055
Easier SingleFontChooserDialog ctor, window pos/size/flags, and more docs (#1704)
* Make SingleFontChooserDialog ctor less confusing

The current constructor expects a new fresh instance of IFontAtlas,
which can be easy to miss, resulting in wasted time troubleshooting
without enough clues. New constructor is added that directly takes an
instance of UiBuilder, and the old constructor has been obsoleted and
should be changed to private on api 10.

* Add position, size, and window flags conf to SFCD

* Improve documentations

* Add test for PopupPosition/Size

---------

Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
2024-03-14 00:57:30 +01:00
Soreepeong
70eecdaaef more 2024-03-05 21:04:20 +09:00
Soreepeong
7f12e3f3da Assign debug names for textures 2024-03-05 01:22:16 +09:00
Soreepeong
6a0f774625 Add texture leak tracker 2024-03-05 01:06:02 +09:00
Soreepeong
858d27ab8e Fix namespace 2024-03-03 20:44:49 +09:00
Soreepeong
c04ce36b9c Add CreateFromGameScreen 2024-03-03 20:08:52 +09:00
Soreepeong
3853191c48 More cleanup 2024-03-03 00:51:28 +09:00
Soreepeong
3415df5d40 Cleanup 2024-03-02 23:45:14 +09:00
Soreepeong
0aa75306d4 fixese 2024-03-02 07:50:37 +09:00
Soreepeong
1ae11440aa Add ITextureProvider.CreateFromExistingTextureAsync 2024-03-02 01:41:11 +09:00
Soreepeong
ca986b46a2 cleanup 2024-02-28 21:17:50 +09:00
Soreepeong
f8492dc06b changes 2024-02-28 19:16:14 +09:00
Soreepeong
71b84bcf40 Move all texture loading functionalities from IM to TM 2024-02-28 17:43:24 +09:00
Soreepeong
0343897113 Better error message for FontHandle 2024-02-28 17:11:29 +09:00
srkizer
2d8b71c647
Add SetFontScaleMode(ImFontPtr, FontScaleMode) (#1666)
* Add SetFontScaleMode(ImFontPtr, FontScaleMode)

`IgnoreGlobalScale` was advertised as "excludes the given font from
global scaling", but the intent I had in mind was "excludes the given
font from being scaled in any manner". As the latter functionality is
needed, obsoleted `IgnoreGlobalScale` and added `SetFontScaleMode`.

* Make it correct

* Name consistency
2024-02-18 15:08:07 +01:00
srkizer
cdaa538e1a
Revert "Warn if font files' hashes are unexpected (#1659)"
This reverts commit 307f0fcbe8.
2024-02-17 23:07:49 +09:00
Soreepeong
f825e86e86 Fix B4G4R4A4->B8G8R8A8 channel extraction
On systems without support for B4G4R4A4 pixel format (when DirectX
feature level 11_1 is missing), the conversion will take place; a
copy-and-paste error made the read pointer advance twice as fast as it
should have been.
2024-02-17 22:44:33 +09:00
srkizer
307f0fcbe8
Warn if font files' hashes are unexpected (#1659) 2024-02-16 17:19:42 +01:00
srkizer
ea43d65636
Fix memory ownership on AddFontFromImGuiHeapAllocatedMemory (#1651) 2024-02-14 23:52:40 +01: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
df89472d4c Consistent BuildTask resolution timing
`BuildFontsImmediately` and `BuildFontsAsync` set `BuildTask` to completion at different point of build process, and changed the code to make it consistent that `BuildTask` is set to completion after `PromoteBuiltData` returns.
2024-01-23 23:50:04 +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