Commit graph

1167 commits

Author SHA1 Message Date
Soreepeong
50f74c55a7 Merge branch 'master' into new_im_hooks 2024-03-21 00:39:26 +09:00
srkizer
be63276a85
Rename to Framework.Run (#1728) 2024-03-19 08:04:21 -07:00
srkizer
5d473919a1
Hide scheduler from RunOnFrameworkThread (#1725)
* Hide scheduler from RunOnFrameworkThread

Creating new tasks via Task.Run and alike would fetch the current
scheduler, which we do not want in case of running stuff from the
framework thread. Change is to prevent the standard library from seeing
the "current scheduler". If one wants to use `await` with an async
function to be run in the framework thread, one can use
`RunOnFrameworkThreadAwaitable` instead now.

* TaskSchedulerWidget: test better stuff

* TaskSchedulerWidget: add freeze tests

* More comments

* Make TaskFactory a getter method instead of property to avoid bad suggestions

* Why are there stuff still not pushed
2024-03-18 20:10:47 -07: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
goat
dcec076ca7
Merge pull request #1681 from Soreepeong/feature/inotificationmanager
Implement INotificationManager
2024-03-16 16:46:12 +01:00
Ridan Vandenbergh
0656a524b1
Add missing space in cross-world PF links (#1717) 2024-03-16 16:45:19 +01:00
Soreepeong
033a57d19d Merge remote-tracking branch 'upstream/master' into feature/inotificationmanager 2024-03-14 13:06:04 +09:00
srkizer
a26bb58fdb
Use custom TaskScheduler for Framework.RunOnTick (#1597)
* Use custom TaskScheduler for Framework.RunOnTick

* TaskSchedulerWidget: add example
2024-03-14 00:36:38 +01:00
srkizer
88a8d45798
Accommodate nested AddonLifecycle event calls (#1698)
* Accommodate nested AddonLifecycle event calls

The game is free to call event handlers of another addon from one addon,
but the previous code was written under the assumption that only one
function may be called at a time. This changes the recycled addon args
into pooled args.

* Always clear addon name cache
2024-03-07 17:47:11 -08:00
Asriel Camora
2cdc1f0171
Fix duty pop chat message italics (#1697) 2024-03-05 17:13:43 +00:00
Aireil
8a21fc721f
feat: add AdjustedTotalCastTime to BattleChara (#1694)
* feat: add AdjustedTotalCastTime to BattleChara

* Update Dalamud/Game/ClientState/Objects/Types/BattleChara.cs

Co-authored-by: KazWolfe <KazWolfe@users.noreply.github.com>

---------

Co-authored-by: KazWolfe <KazWolfe@users.noreply.github.com>
2024-03-04 09:51:25 -08:00
Asriel Camora
5f62c703bf
Add IContextMenu service (#1682) 2024-02-29 15:15:02 -08:00
Soreepeong
7aba15ef5b Normalize namespaces 2024-02-28 17:11:29 +09:00
Soreepeong
a3217bb86d Remove InitialiationTask from interface 2024-02-21 16:34:53 +09:00
Soreepeong
c27422384f IGameConfig: fix load-time race condition
As some public properties of `IGameConfig` are being set on the first
`Framework` tick, there was a short window that those properties were
null, which goes against the interface declaration.

This commit fixes that, by making those properties block for the full
initialization of the class.

A possible side effect is that a plugin that is set to block the game
from loading until it loads will now hang the game if it tries to access
the game configuration from its constructor, instead of throwing a
`NullReferenceException`. As it would mean that the plugin was buggy at
the first place and it would have sometimes failed to load anyway, it
might as well be a non-breaking change.
2024-02-20 15:37:54 +09:00
srkizer
6497c62622
Change MemoryHelper to allocate less (#1657)
* Change MemoryHelper to allocate less

* Use StringBuilder pool for ReadSeStringAsString

* fix

* Use CreateReadOnlySpanFromNullTerminated where possible
2024-02-16 17:16:21 +01:00
Kurochi51
14c5ad1605
Expose CharacterData.ShieldValue to Dalamud's Character wrapper. (#1608) 2024-01-18 20:56:12 +01:00
KazWolfe
86b7c29e94
fix: Make auto-update work again, the lazy way (#1592)
* fix: Make auto-update work again, the lazy way.

- Move auto-update to run on the first `Notice` message for parity with the welcome message.
- Add some logging in a few critical places to make things nicer.

* fix overzealous IDE complaints

* code-review comments

- Remove stray imports that the IDE included
- Remove fixme to move auto-updates (for now)

* Lazy retry auto-update
2024-01-13 20:17:26 +01:00
MidoriKami
02b1f6e426
[AddonEventManager] Actually Ensure Thread Safety (#1589)
* Actually make AddonEventManager thread safe

* Ensure AddonEventHandlers are also thread safe

Additionally, use Guid instead of strings

* Make DalamudInternalKey readonly

* Properly use ConcurrentDict features

Fixes GUID not working
2023-12-31 14:30:21 -08:00
Soreepeong
2c3139d8b7 Ensure borders on IME mode foreground icon 2023-12-17 11:59:11 +09:00
Soreepeong
b6d88f798a Make CJK imes work better 2023-12-17 11:59:11 +09:00
MidoriKami
df1cdff1a5
AddonEventManager fix thread safety (#1576)
Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
2023-12-16 21:01:40 +01:00
MidoriKami
5a5cc5701a
Hotfix for AddonArgs infinite loop (#1571) 2023-12-10 04:30:58 +00:00
srkizer
4d0cce134f
Fix AddonLifecycle ABI; deprecate arg class public ctors (#1570) 2023-12-09 19:35:40 -08:00
Haselnussbomber
8f243762cc
ChatGui: fix for new message sounds and interactable links (#1568)
* Change PrintMessage parameters type to byte

* Use Utf8String.AsSpan

* Fix InteractableLinkClickedDetour using the wrong variable
2023-12-08 16:23:04 -08:00
srkizer
0bfcc55774
Reduce heap allocation every frame in AddonLifecycle (#1555) 2023-12-08 00:49:09 +01:00
goat
711d5e2859
Merge pull request #1554 from Soreepeong/GameInventory 2023-12-08 00:42:47 +01:00
Haselnussbomber
9489c4ec20
Refactor ChatGui internals to use CS additions (#1520)
Co-authored-by: goat <16760685+goaaats@users.noreply.github.com>
2023-12-08 00:22:09 +01:00
srkizer
30c2872400
Fix ChatGui race condition (#1563) 2023-12-08 00:08:43 +01:00
srkizer
a0f4baf8fa
Less footguns in service dependency handling (#1560) 2023-12-06 21:29:46 -08:00
Soreepeong
ba5e3407d6 Permaenable raptureAtkModuleUpdateHook 2023-12-02 13:53:00 +09:00
Soreepeong
841c47e186 Use RaptureAtkModule.Update as a cue for checking inventory changes 2023-12-02 13:44:28 +09:00
Soreepeong
e594d59986 Enable tracking only when there exists a subscriber 2023-12-02 12:58:55 +09:00
Soreepeong
5f0b65a6c4 last 2023-12-02 11:08:12 +09:00
Soreepeong
6b4094d89a Fix missing event handler registration 2023-12-02 11:06:11 +09:00
Soreepeong
35b0d53e80 Add typed event variants 2023-12-02 10:59:13 +09:00
Soreepeong
b2fc0c4ad2 Adjust namespaces 2023-12-02 10:33:20 +09:00
Soreepeong
05820ad9c7 Rename 2023-12-02 10:25:10 +09:00
Soreepeong
e4370ed5d3 Extra note 2023-12-02 10:23:36 +09:00
Soreepeong
1039c1eb8a Cleanup 2023-12-02 10:22:07 +09:00
Soreepeong
6dd34ebda4 support merge/split events 2023-12-01 22:37:24 +09:00
Soreepeong
f8dff15fe0 fix bugs 2023-12-01 22:02:08 +09:00
Soreepeong
35f4ff5c94 wip 2023-12-01 21:51:09 +09:00
Soreepeong
34e3adb3f2 wip; needs testing and more thinking 2023-12-01 18:10:43 +09:00
MidoriKami
7c6f98dc9f Proposed API Surface 2023-11-30 22:18:33 -08:00
MidoriKami
40575e1a88 Use ReadOnlySpan 2023-11-30 21:28:37 -08:00
Soreepeong
000d16c553 Assume the size of inventory does not change once it's set 2023-12-01 13:15:19 +09:00
Soreepeong
5204bb723d Optimizations 2023-11-30 20:42:34 +09:00
MidoriKami
805615d9f4 Fix incorrect equality operator 2023-11-30 20:22:08 +09:00
MidoriKami
92f4df625f [GameInventory] Service Prototype 2023-11-30 20:22:08 +09:00