8000 Added a button to launch in Demo mode by jopejoe1 · Pull Request #903 · PolyMC/PolyMC · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Added a button to launch in Demo mode #903

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

Merged
merged 6 commits into from
Sep 18, 2022
Merged

Added a button to launch in Demo mode #903

merged 6 commits into from
Sep 18, 2022

Conversation

jopejoe1
Copy link
Contributor

Adding a button to launch in demo mode, similar to the button that launches offline mode.

Supersedes #899
Closes #867

@jopejoe1 jopejoe1 mentioned this pull request Jul 11, 2022
Copy link
Contributor
@flowln flowln left a comment

Choose a reason for hiding this comment

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

looks good!

two things:

  1. Unlike the normal launch and the offline launch options, the demo launch does not have a shortcut set (Like 'Ctrl+O' for the normal launch and 'Ctrl-Shift-O' for the offline one). While I don't know if the demo option will be used enough to warrant a shortcut for itself, it looks kinda odd comparing them side by side o.O

  2. Seems like the 'demo' option isn't currently working for older MC versions. This is due to the legacy launcher not propagating the state. I've made a patch fixing this, I think it would fit in this PR instead of going into a separate one, what do you think?

the patch:

From 9fce42c01c20338891033e802e5de12195f3cbc8 Mon Sep 17 00:00:00 2001
From: flow <flowlnlnln@gmail.com>
Date: Wed, 13 Jul 2022 15:45:41 -0300
Subject: [PATCH] fix: allow demo for older versions

We were not propagating the '--demo' flag in the legacy launcher,
unconditionally setting the 'demo' parameter to false.

Signed-off-by: flow <flowlnlnln@gmail.com>
---
 libraries/launcher/org/polymc/applet/LegacyFrame.java  | 5 +++--
 libraries/launcher/org/polymc/impl/OneSixLauncher.java | 3 ++-
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libraries/launcher/org/polymc/applet/LegacyFrame.java b/libraries/launcher/org/polymc/applet/LegacyFrame.java
index 2cdd17d7..7ae56e60 100644
--- a/libraries/launcher/org/polymc/applet/LegacyFrame.java
+++ b/libraries/launcher/org/polymc/applet/LegacyFrame.java
@@ -63,7 +63,8 @@ public final class LegacyFrame extends Frame {
         int winSizeH,
         boolean maximize,
         String serverAddress,
-        String serverPort
+        String serverPort,
+        boolean isDemo
     ) {
         // Implements support for launching in to multiplayer on classic servers using a mpticket
         // file generated by an external program and stored in the instance's root folder.
@@ -106,7 +107,7 @@ public final class LegacyFrame extends Frame {
         appletWrap.setParameter("sessionid", session);
         appletWrap.setParameter("stand-alone", "true"); // Show the quit button.
         appletWrap.setParameter("haspaid", "true"); // Some old versions need this for world saves to work.
-        appletWrap.setParameter("demo", "false");
+        appletWrap.setParameter("demo", isDemo ? "true" : "false");
         appletWrap.setParameter("fullscreen", "false");
 
         add(appletWrap);
diff --git a/libraries/launcher/org/polymc/impl/OneSixLauncher.java b/libraries/launcher/org/polymc/impl/OneSixLauncher.java
index 362ff8d6..28c3aaa6 100644
--- a/libraries/launcher/org/polymc/impl/OneSixLauncher.java
+++ b/libraries/launcher/org/polymc/impl/OneSixLauncher.java
@@ -137,7 +137,8 @@ public final class OneSixLauncher implements Launcher {
                         winSizeH,
                         maximize,
                         serverAddress,
-                        serverPort
+                        serverPort,
+                        mcParams.contains("--demo")
                 );
 
                 return;
-- 
2.35.1

@jopejoe1
Copy link
Contributor Author

Unlike the normal launch and the offline launch options, the demo launch does not have a shortcut set (Like 'Ctrl+O' for the normal launch and 'Ctrl-Shift-O' for the offline one). While I don't know if the demo option will be used enough to warrant a shortcut for itself, it looks kinda odd comparing them side by side o.O

I was thinking of using 'Ctrl-Alt-O' or 'Ctrl-Shift-D'.

Seems like the 'demo' option isn't currently working for older MC versions. This is due to the legacy launcher not propagating the state. I've made a patch fixing this, I think it would fit in this PR instead of going into a separate one, what do you think?

I have applied the patch to this pr. As I agree that they fit in together.

@flowln
Copy link
Contributor
flowln commented Jul 13, 2022

I was thinking of using 'Ctrl-Alt-O' or 'Ctrl-Shift-D'.

I guess the 'Ctrl+Alt+O' makes more sense to me (the one with 'D' looks more like a delete operation IMO xd), but I don't know about it triggering the menu bar, it's quite odd :/

Anyway, i discovered that Ctrl+D is for copying instances, which is quite an odd choice xD so i guess you can do whatever you want!

@jopejoe1
Copy link
Contributor Author

I guess the 'Ctrl+Alt+O' makes more sense to me (the one with 'D' looks more like a delete operation IMO xd), but I don't know about it triggering the menu bar, it's quite odd :/

After setting a shortcut for 'Ctrl+Alt+O' it no longer inherits the action of 'Ctrl+Alt'

@flowln
Copy link
Contributor
flowln commented Jul 13, 2022

After setting a shortcut for 'Ctrl+Alt+O' it no longer inherits the action of 'Ctrl+Alt'

great! :D

@Scrumplex
Copy link
Contributor

This doesn't work if the instance you are trying to start hasn't downloaded all libraries yet.

Apart from that, I don't really like that the button is as prominent as the other two launch options. The vast majority of users will probably never start demo mode. Maybe it would be better to make it a checkbox or something when clicking on Launch Offline

@flowln
Copy link
Contributor
flowln commented Jul 13, 2022

This doesn't work if the instance you are trying to start hasn't downloaded all libraries yet.

I've noticed this too, but it seems to be a general problem with the offline mode, not just the demo, so idk if it's in this PR's scope o.O

@flowln flowln added the enhancement New feature or request label Jul 18, 2022
@flowln flowln added this to the 1.5.0 milestone Jul 23, 2022
@forkiesassds
Copy link

Demo mode was added in Release 1.3, would be a good idea to disable versions before 1.3

jopejoe1 and others added 6 commits September 15, 2022 18:44
Signed-off-by: jopejoe1 <johannes@joens.email>
We were not propagating the '--demo' flag in the legacy launcher,
unconditionally setting the 'demo' parameter to false.

Signed-off-by: flow <flowlnlnln@gmail.com>
Signed-off-by: jopejoe1 <johannes@joens.email>
Signed-off-by: flow <flowlnlnln@gmail.com>
Signed-off-by: flow <flowlnlnln@gmail.com>
e.g. >= 1.3.1 instances

Signed-off-by: flow <flowlnlnln@gmail.com>
@flowln
Copy link
Contributor
flowln commented Sep 15, 2022

@jopejoe1 i've rebased and made a couple of changes with respect to the comments above. Can you take a look and see if you agree with those? 🥺

I'm not sure whether we should leave the demo button in the instance settings page, while it is less important than the other two, we also have a lot of empty space in there, so it's not a bit issue either. What do you think?

@jopejoe1
Copy link
Contributor Author
jopejoe1 commented Sep 16, 2022

The changes you made look good to me. 🙂

Edit: With moving the Launch Demo button into the Launch Offline button, it is not possible to launch demo mode together with a profiler.

@flowln
Copy link
Contributor
flowln commented Sep 16, 2022

Edit: With moving the Launch Demo button into the Launch Offline button, it is not possible to launch demo mode together with a profiler.

yeah, but I don't see much value in that tbh. what would be the use case of profiling demo mode? xD

@jopejoe1
Copy link
Contributor Author

Edit: With moving the Launch Demo button into the Launch Offline button, it is not possible to launch demo mode together with a profiler.

yeah, but I don't see much value in that tbh. what would be the use case of profiling demo mode? xD

true 🙃

@flowln flowln requested a review from Scrumplex September 18, 2022 11:37
Copy link
Contributor
@Scrumplex Scrumplex left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks

@Scrumplex Scrumplex merged commit 098327f into PolyMC:develop Sep 18, 2022
@jopejoe1 jopejoe1 deleted the demo-launch branch September 18, 2022 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot launch Demo Mode
4 participants
0