Commit graph

14 commits

Author SHA1 Message Date
Mary-nyan
f4e879a1e6
Reduce usage of Marshal.PtrToStructure and Marshal.StructureToPtr (#3805)
* common: Make BinaryReaderExtensions Read & Write take unamanged types

This allows us to not rely on Marshal.PtrToStructure and Marshal.StructureToPtr for those.

* common: Make MemoryHelper Read & Write takes unamanged types

* Update Marshal.SizeOf => Unsafe.SizeOf when appropriate and start moving software applet to unmanaged types
2022-11-24 15:26:29 +01:00
Berkan Diler
d751da84f9
Use new C# 11 u8 string literals (#3854) 2022-11-16 16:30:12 -03:00
gdkchan
a5ff0024fb
Rename ToSpan to AsSpan (#3556) 2022-08-11 18:07:37 -03:00
Mary
30ee70a9bc
time: Make TimeZoneRule blittable and avoid copies (#3361)
* time: Make TimeZoneRule blittable and avoid copies

This drastically reduce overhead of using TimeZoneRule around the
codebase.

Effect on games is unknown

* Add missing Box type

* Ensure we clean the structure still

This doesn't perform any copies

* Address gdkchan's comments

* Simplify Box
2022-06-24 19:04:57 +02:00
Mary
51fa1b2cb0
hle: Improve safety (#2778)
* timezone: Make timezone implementation safe

* hle: Do not use TrimEnd to parse ASCII strings

This adds an util that handle reading an ASCII string in a safe way.
Previously it was possible to read malformed data that could cause
various undefined behaviours in multiple services.

* hid: Remove an useless unsafe modifier on keyboard update

* Address gdkchan's comment

* Address gdkchan's comment
2021-10-24 19:13:20 -03:00
Ac_K
5d08e9b495
hos: Cleanup the project (#2634)
* hos: Cleanup the project

Since a lot of changes has been done on the HOS project, there are some leftover here and there, or class just used in one service, things at wrong places, and more.
This PR fixes that, additionnally to that, I've realigned some vars because I though it make the code more readable.

* Address gdkchan feedback

* addresses Thog feedback

* Revert ElfSymbol
2021-09-15 01:24:49 +02:00
mageven
6982282cc8
TZ: Fix loop condition in GetTZName (#1950)
Closes #1949
2021-01-23 13:29:14 +01:00
Thog
f617fb542a Fix timezone month being reported incorrectly to games (#861)
Nintendo actually uses range from 1 to 12 for months (when original timezone code manage 0-11)
2020-01-09 11:08:57 +11:00
Thog
a0e0745f2f Remove one extraneous incrementation (#833)
This incrementation is entirely wrong.
2019-11-25 10:32:07 +11:00
Thomas Guillemard
1aba033ba7 Update time implementation to 9.0.0 (#783)
* Fix 9.0.0 related services bindings

This was wrong because of a mistake on switchbrew.

* Fix wronog cmdid for ISteadyClock::GetTestOffset/SetTestOffset

* Update ClockCore logics to 9.0.0

Also apply 9.0.0 permissions and comment time:u, and time:a (as those
are going to be moved)

* Move every clocks instances + timezone to a global manager

* Start implementing time:m

Also prepare the skeleton of the shared memory

* Implement SystemClockContextUpdateCallback and co

* Update StaticService to 9.0.0

* Update ISystemClock to 9.0.0

* Rename IStaticService and add glue's IStaticService

* Implement psc's ITimeZoneService

* Integrate psc layer into glue for TimeZoneService

* Rename TimeZoneManagerForPsc => TimeZoneManager

* Use correct TimeZoneService interface for both StaticService implementations

* Accurately implement time shared memory operations

* Fix two critical flaws in TimeZone logic

The first one was the month range being different fron Nintendo one
(0-11 instead of 1-12)

The other flaw was a bad incrementation order during days & months
computation.

* Follow Nintendo's abort logic for TimeManager

* Avoid crashing when timezone sysarchive isn't present

* Update Readme

* Address comments

* Correctly align fields in ISystemClock

* Fix code style and some typos

* Improve timezone system archive warning/error messages

* Rearrange using definitions in Horizon.cs

* Address comments
2019-10-08 14:48:49 +11:00
Ac_K
a0720b5681 Refactoring HOS folder structure (#771)
* Refactoring HOS folder structure

Refactoring HOS folder structure:

- Added some subfolders when needed (Following structure decided in private).
- Added some `Types` folders when needed.
- Little cleanup here and there.
- Add services placeholders for every HOS services (close #766 and #753).

* Remove Types namespaces
2019-09-19 10:45:11 +10:00
Thomas Guillemard
b9c94ada34 timezone: improve sanity checks on TimeZone Rule name (#758) 2019-09-04 18:10:15 +02:00
Ac_K
4ad3936afd Refactoring result codes (#731)
* refactoring result codes

- Add a main enum who can handle some orphalin result codes and the default `ResultCode.Success` one.
- Add sub-enum by services when it's needed.
- Remove some empty line.
- Recast all service calls to ResultCode.
- Remove some unneeded static declaration.
- Delete unused `NvHelper` class.

* NvResult is back

* Fix
2019-07-14 16:04:38 -03:00
Thomas Guillemard
708620252e ITimeZoneService rewrite (#722)
* Clean up ITimeZoneService

Add error codes and simplify parsing

* Add accurate timezone logic

TOOD: LoadTimeZoneRule and location name cmds.

* Integrate the new TimeZone logic

* SCREAMING_UNIX_CASE => PascalCase

* Address comments

* Reduce use of pointer in the LoadTimeZoneRule logic

* Address comments

* Realign tzIfStream logic in LoadTimeZoneRule

* Address gdk's comments
2019-07-04 17:20:40 +02:00