Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Feature] Zenless Zone Zero Game Setings #532

Merged
merged 46 commits into from
Jul 13, 2024
Merged

[New Feature] Zenless Zone Zero Game Setings #532

merged 46 commits into from
Jul 13, 2024

Conversation

bagusnl
Copy link
Member

@bagusnl bagusnl commented Jul 11, 2024

Main Goal

Implements Zenless Game Settings to Collapse

image

image

PR Status :

  • Overall Status : Done
  • Commits : Done
  • Synced to base (Collapse:main) : Yes
  • Build status : OK
  • Crashing : No
  • Bug found caused by PR :
    • [Low] Save output of GSP for GENERAL_DATA is not indented like how the game outputs it
    • [Low] "Use Resizable Window" gets enabled when toggling "Use Borderless Windowed Mode" on and off

bagusnl and others added 27 commits July 3, 2024 18:49
NOTE:
- Reverse Encode needs checking
- GeneralData is still F'd
- I'm eepy
WARNING: WILL CRASH WHEN OPENING THE PAGE
- Initialize General Data settings later due to certain properties are not initialized sooner
- Fix path for general data config file
- Fix frontend format
As the file is based on the old and obsolete BinaryFormatter serializer and no longer available for future .NET runtime releases, emulating the read/write routine should do the trick.

Thanks @shatyuka for the help on the initial implementation

- Adding basic props for ZZZ ``GeneralData`` class

- Remove unused Encoder method

- Clean-up namespaces

- Implement JsonNode De/Serializer API

- Implement JsonNode's Getter and Setter

This is the difficult one :pepeHands:

- Remove testing setter

Co-authored-by: Shatyuka <[email protected]>
Co-authored-by: Bagus Nur Listiyono <[email protected]>
Thank you for forcing us to use JsonNode this time.
Fucc you, HoYo! :frick:
Also suppress interface warning by implementing Load() and LoadWithMagic() but cast the method from base
also add render res enum
- Do manual conversion of int <=> bool
- Add :FRICK: tons of the keys
- New enum, preset
+ This is useful to avoid NRE error if the new GeneralData() or any MagicNodeBaseValues<T> members are faulty or null. So instead of letting it null, we will instead create a new default instance of it.
+ This also can be useful to create a new default values of GENERAL_DATA.bin or any MagicNodeBaseValues<T> type files if don't exist.
+ Fix the bug by flushing the writer before reusing it
WARNING: NOT YET TIED INTO GENERAL DATA
+ Fix double disposal when cleaning-up log folder
+ Fix crash upon cleaning-up log folder
+ Fix the log files don't contain launcher infos
+ Fix where the launcher have "vUnknown" prefixes
+ Fix logs do not append to the last line on launcher re-run
+ Fix Console window sometime spawned for a moment on start-up, even with "Show Console" not enabled
@bagusnl bagusnl closed this Jul 11, 2024
@bagusnl
Copy link
Member Author

bagusnl commented Jul 11, 2024

forgor how mad qodana will be on in progress feature. will reopen when stuff is mostly done

- Preset selector logic still buggy
- Might look wonky atm
- Some strings not localized
@bagusnl bagusnl added Enhancement New feature or request Game: Zenless Zone Zero Issue labeled for Zenless Zone Zero Area: Game Settings Issue labeled for Game Settings related issues labels Jul 12, 2024
@bagusnl bagusnl marked this pull request as ready for review July 12, 2024 23:57

// Write into the file
string jsonString = SettingsJsonNode.SerializeJsonNode(Context, false, false);
Sleepy.WriteString(filePath!, jsonString, Magic);

Check warning

Code scanning / QDNET

Redundant nullable warning suppression expression Warning

The nullable warning suppression expression is redundant

try
{
string? filePath = versionManager.ConfigFilePath;

Check warning

Code scanning / QDNET

Variable can be declared as non-nullable Warning

'filePath' can be declared as non-nullable
public void Save()
{
// Get the file and dir path
string? filePath = GameVersionManager.ConfigFilePath;

Check warning

Code scanning / QDNET

Variable can be declared as non-nullable Warning

'filePath' can be declared as non-nullable
bagusnl and others added 3 commits July 13, 2024 13:25
It causes EVERY popup to be disabled, not just sliders
and yeah, it does it for the entire app LMAO
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

Check warning

Code scanning / QDNET

Redundant using directive Warning

Using directive is not required by the code and can be safely removed
Copy link
Member

@neon-nyan neon-nyan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I Approb!

@bagusnl
Copy link
Member Author

bagusnl commented Jul 13, 2024

approball accepted, merging changes by merge commit

Thanks all for this painful GSP implementation~

@bagusnl bagusnl merged commit 2f21edc into main Jul 13, 2024
6 checks passed
This was referenced Jul 13, 2024
Cryotechnic added a commit that referenced this pull request Jul 16, 2024
# What's New? - 1.80.16
> ### Note regarding Sophon / Genshin Preload saying `Download` after
preload is completed
> This has been fixed in this release, _but_ you have to do it once to
make the identifier file that the preload is completed. There will be no
significant download happened, it will just verify the downloaded
chunks.
> After that, the dialog should say its finished downloading and the
button turns to `Verify Package Integrity`.
> While verifying it will says "Downloading", this _might_ not be true
as both download and verification happened in the same method. Check
network activity in the task manager if you are curious.

- **[New]** Zenless Zone Zero Game Settings Integration, by @bagusnl,
@neon-nyan, @shatyuka
- You can now change Graphics, Audio, and Language settings for your
game before even running it!
- This was a fun one, over 4k lines of code in the single PR (mostly)
for this feature.
- Almost half of them was just the necessary code for Collapse to be
able to read and write the settings to the necessary places. Thanks
@shatyuka and @neon-nyan for all of those mumbo jumbo that @bagusnl
can't even comprehend with a cup of coffee, or three.
- For more fun details, you can go and open this [pull
request](#532)
- **[Fix]** Various fixes for Sophon download method, by @neon-nyan 
  - Adding an indicator if Sophon Mode is used
- Fix Sophon preload completion is not detectable, now finished Sophon
download should show `Verify` button instead of `Download`
- Fix thread exhaustion caused by too many connections being made
leading to premature download stop (stuck download)
- Fix (hopefully) unknown thrown, causing the preload download to gets
finished prematurely
- **[Fix]** Bump NuGets and dotNET SDK to mitigate vulnerability, by
@bagusnl
- While Collapse is not affected by this, we always try to be up to date
and bump all vulnerability that might get included with our package,
dotNET included as we publish them with all the necessary runtime dlls
(notice you never had to update dotNET runtime for Collapse?)
- This mitigate vulnerability found in System.Text.Json built-in JSON
parser for dotNET. Read more about it
[here](https://github.com/CollapseLauncher/Collapse/security/dependabot/2)
- **[Fix]** Clearing log files causing launcher to crash, by @neon-nyan 
- **[Fix]** Console might get displayed for a brief moment on launch
when its disabled, by @neon-nyan
- **[Fix]** Allow system to sleep after Sophon download is completed, by
@bagusnl
- **[Imp]** New slider style, by @neon-nyan 
- **[Imp]** Use same GUID for Tray Icon on launch, by @bagusnl 
- This is to prevent Tray Icon preference (visibility, order, etc.) to
change when the app path changed like after an update
Cryotechnic added a commit that referenced this pull request Jul 16, 2024
# What's New? - 1.80.16
> ### Note regarding Sophon / Genshin Preload saying `Download` after
preload is completed
> This has been fixed in this release, _but_ you have to do it once to
make the identifier file that the preload is completed. There will be no
significant download happened, it will just verify the downloaded
chunks.
> After that, the dialog should say its finished downloading and the
button turns to `Verify Package Integrity`.
> While verifying it will says "Downloading", this _might_ not be true
as both download and verification happened in the same method. Check
network activity in the task manager if you are curious.

- **[New]** Zenless Zone Zero Game Settings Integration, by @bagusnl,
@neon-nyan, @shatyuka
- You can now change Graphics, Audio, and Language settings for your
game before even running it!
- This was a fun one, over 4k lines of code in the single PR (mostly)
for this feature.
- Almost half of them was just the necessary code for Collapse to be
able to read and write the settings to the necessary places. Thanks
@shatyuka and @neon-nyan for all of those mumbo jumbo that @bagusnl
can't even comprehend with a cup of coffee, or three.
- For more fun details, you can go and open this [pull
request](#532)
- **[Fix]** Various fixes for Sophon download method, by @neon-nyan 
  - Adding an indicator if Sophon Mode is used
- Fix Sophon preload completion is not detectable, now finished Sophon
download should show `Verify` button instead of `Download`
- Fix thread exhaustion caused by too many connections being made
leading to premature download stop (stuck download)
- Fix (hopefully) unknown thrown, causing the preload download to gets
finished prematurely
- **[Fix]** Bump NuGets and dotNET SDK to mitigate vulnerability, by
@bagusnl
- While Collapse is not affected by this, we always try to be up to date
and bump all vulnerability that might get included with our package,
dotNET included as we publish them with all the necessary runtime dlls
(notice you never had to update dotNET runtime for Collapse?)
- This mitigate vulnerability found in System.Text.Json built-in JSON
parser for dotNET. Read more about it
[here](https://github.com/CollapseLauncher/Collapse/security/dependabot/2)
- **[Fix]** Clearing log files causing launcher to crash, by @neon-nyan 
- **[Fix]** Console might get displayed for a brief moment on launch
when its disabled, by @neon-nyan
- **[Fix]** Allow system to sleep after Sophon download is completed, by
@bagusnl
- **[Imp]** New slider style, by @neon-nyan 
- **[Imp]** Use same GUID for Tray Icon on launch, by @bagusnl 
- This is to prevent Tray Icon preference (visibility, order, etc.) to
change when the app path changed like after an update


### Templates

<details>
  <summary>Changelog Prefixes</summary>
  
  ```
    **[New]**
    **[Imp]**
    **[Fix]**
    **[Loc]**
    **[Doc]**
  ```

</details>
@NSPC911
Copy link
Contributor

NSPC911 commented Jul 25, 2024

you forgot to change the readme lol

@bagusnl bagusnl deleted the zzz-settings branch August 2, 2024 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Game Settings Issue labeled for Game Settings related issues Enhancement New feature or request Game: Zenless Zone Zero Issue labeled for Zenless Zone Zero
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants