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

Launcher with problems to accept args in 6.1.0 #94

Closed
gwopontes opened this issue Aug 5, 2020 · 1 comment
Closed

Launcher with problems to accept args in 6.1.0 #94

gwopontes opened this issue Aug 5, 2020 · 1 comment
Assignees
Labels
All platforms Issue related to the all platforms bug Something isn't working good first issue Good for newcomers

Comments

@gwopontes
Copy link

gwopontes commented Aug 5, 2020

Launcher is just accepting fontsize, datapath and scr

Describe the bug

When trying to add parameters in Launcher like /density or any other, console shows error.

To Reproduce

TotalCrossApplication.run(DashboardSample.class, "/scr", "848x480x24", "/density", "1.0");

Devices:

Please complete the following information:

  • Device: Java
  • TotalCross Version: 6.1.0

Additional context

Console Output:

bash-3.2$  cd /Users/gustavopontes/Desktop/TotalCross/dashboard_sample ; /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home/bin/java -agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:58026 -Dfile.encoding=UTF-8 -cp /var/folders/br/c34ff32x20l6ssk_23_sgs240000gn/T/cp_4ew025rtyikm2ugcg3c0lo43t.jar com.totalcross.sample.dashboard.RunDashboardSampleApplication 
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Screen is 848x480x24
Possible Arguments (in any order and case insensitive). Default is marked as *
   /scr WIDTHxHEIGHT     : sets the width and height resolution.
   /scr WIDTHxHEIGHTxBPP : sets the width, height and bits per pixel (8, 16, 24 or 32)
   /density <0.1 to 4>   : sets the screen pixel density
   /scr win32       : Windows 32          (same of /scr 240x320x24)
*  /scr android     : Android             (same of /scr 320x568x24)
   /scr iphone      : iPhone 8 resolution (same of /scr 750x1334x24 /density 2)
   /scr ipad        : iPad resolution     (same of /scr 1536x2048x24 /density 2)
   /pos x,y         : Sets the openning position of the application
   /uiStyle Flat    : Flat user interface style
*  /uiStyle Vista   : Vista user interface style
   /uiStyle Android : Android 4 user interface style
   /uiStyle Holo    : Android 5 user interface style
   /uiStyle Material: Material 6 user interface style
   /penlessDevice   : acts as a device that has no touchscreen.
   /fingerTouch     : acts as a device that uses a finger instead of a pen.
   /unmovablesip    : acts as a device whose SIP is unmovable (like in Android and iPhone).
   /geofocus        : enables geographical focus.
   /virtualKeyboard : shows the virtual keyboard when in an Edit or a MultiEdit
   /showmousepos    : shows the mouse position.
   /bpp 8           : emulates 8  bits per pixel screens (256 colors)
   /bpp 16          : emulates 16 bits per pixel screens (64K colors)
   /bpp 24          : emulates 24 bits per pixel screens (16M colors)
   /bpp 32          : emulates 32 bits per pixel screens (16M colors without transparency)
   /scale <0.1 to 8>: scales the screen, using by default a method that gives higher priority to image smoothness than scaling speed.
   /fastscale       : combined with scale, changes its default scaling method for one that gives higher priority to scaling speed than smoothness of the scaled image.
   /dataPath <path> : sets where the PDB and media files are stored
   /cmdLine <...>   : the rest of arguments-1 are passed as the command line
   /fontSize <size> : set the default font size to the one passed as parameter
The class name that extends MainWindow must always be the last argument
Please notice that the Launcher automatically scales down the resolution to fit in the display, to disable this behavior you may include the argument scale with the value 1
Invalid or incomplete argument at position 3: 1.0
null
Full command line:
/scr 848x480x24 /density 1.0
bash-3.2$ 
@gwopontes gwopontes added the bug Something isn't working label Aug 5, 2020
@acmlira acmlira self-assigned this Aug 6, 2020
@acmlira acmlira added good first issue Good for newcomers java All platforms Issue related to the all platforms labels Aug 6, 2020
acmlira added a commit that referenced this issue Aug 6, 2020
The */r* argument was the argument that referenced TotalCross's serial license number. To keep backwards compatibility, we just skipped what it would do, but we didn't do it the right way. This patch adjust the argument iterator, it has no effect when being incremented within the `if`.
@acmlira
Copy link
Contributor

acmlira commented Aug 6, 2020

The removal of the key system left this residue in Launcher.java:

...   
System.out.println("Screen is " + toWidth + "x" + toHeight + "x" + toBpp);
    } else if (args[i++].equalsIgnoreCase("/r")) {
        // Ignore next argument
    } else if (args[i].equalsIgnoreCase("/pos")) /* x,y */
...

the code was waiting for the serial number that should not be passed anymore! I made a pull request to fix i++ inside the /r if, see #95.

@acmlira acmlira closed this as completed Aug 6, 2020
acmlira added a commit that referenced this issue Aug 7, 2020
adjust array iterator, it has no effect when being incremented within the if
ItaloYeltsin pushed a commit that referenced this issue Aug 7, 2020
The */r* argument was the argument that referenced TotalCross's serial license number. 
To keep backwards compatibility, we just skipped what it would do, but we didn't do it the right way. This patch adjust the argument iterator, it has no effect when being incremented within the `if`.
ItaloYeltsin pushed a commit that referenced this issue Aug 10, 2020
The */r* argument was the argument that referenced TotalCross's serial license number. 
To keep backwards compatibility, we just skipped what it would do, but we didn't do it the right way. This patch adjust the argument iterator, it has no effect when being incremented within the `if`.
flsobral pushed a commit that referenced this issue Aug 11, 2020
The */r* argument was the argument that referenced TotalCross's serial license number. 
To keep backwards compatibility, we just skipped what it would do, but we didn't do it the right way. This patch adjust the argument iterator, it has no effect when being incremented within the `if`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
All platforms Issue related to the all platforms bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants