-
Notifications
You must be signed in to change notification settings - Fork 52
add a timeout to auto select method #3
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,7 +82,7 @@ public void run() | |
| console = new PrintStream(new MessagesOutputStream(messages, scene)); | ||
| //InputStream is = getClass().getResourceAsStream("/program.data.bin"); | ||
| //CRunTime.init(is); | ||
|
|
||
| console.println("Hen Loader LP v1.0, based on:"); | ||
| console.println("- GoldHEN 2.4b18.7 by SiSTR0"); | ||
| console.println("- poops code by theflow0"); | ||
|
|
@@ -112,11 +112,39 @@ public void run() | |
| } else { | ||
| console.println("* X = Poops"); | ||
| } | ||
|
|
||
| console.println("(Auto-selecting in 1 second...)"); | ||
|
|
||
| long startTime = System.currentTimeMillis(); | ||
| long timeout = 1000; // 1 second | ||
| boolean autoSelected = false; | ||
|
|
||
| while ((c != BUTTON_O || !lapseSupported) && c != BUTTON_X) | ||
| { | ||
| c = pollInput(); | ||
| long currentTime = System.currentTimeMillis(); | ||
| if (currentTime - startTime >= timeout && c == 0) | ||
lucaslealdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| c = BUTTON_X; | ||
| autoSelected = true; | ||
| break; | ||
| } | ||
| if (c == 0) { | ||
| try { | ||
| Thread.sleep(10); // Small sleep to avoid busy waiting | ||
| } catch (InterruptedException e) { | ||
| break; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| if (autoSelected) { | ||
lucaslealdev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if (lapseSupported) { | ||
| console.println("Auto-selected: Lapse"); | ||
| } else { | ||
| console.println("Auto-selected: Poops"); | ||
| } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. using this might be a little helpful console.println("Auto-selected: " + (lapseSupported ? "Lapse" : "Poops"));
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it would become simpler, one line Okay mate I'll use "Add a suggestion" button from now on, thank you for your effort.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code quality is not measured by number of lines, there are other factors involved. But your suggestion was good. |
||
| } | ||
|
|
||
| if (c == BUTTON_X && lapseSupported) | ||
| { | ||
| int result = org.bdj.external.Lapse.main(console); | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.