r2-studio / robotmon-scripts

Run Javascript on Android. Screenshot, Touch, ...
Apache License 2.0
78 stars 64 forks source link

com.r2studio.TsumBeta v64 TypeError occurs on Galaxy S21 Ultra after One UI 6.0 update #506

Open baggle opened 5 months ago

baggle commented 5 months ago

Using a Galaxy S21 Ultra with up to date robotmon connected via USB to Windows PC running Simple Service Manager 1.6.1

Getting a TypeError on starting the script with this output on the Service Logger:

[R5CR61EFM5E][15:03:51] wait loop stop... [R5CR61EFM5E][15:03:49] [R:0 S:0] [TsumTsum] Stop [R5CR61EFM5E][15:03:45] [Result] {"result":"Run script error: TypeError: Cannot access member 'r' of undefined","rid":35} [R5CR61EFM5E][15:03:45] [Error] Run script error: TypeError: Cannot access member 'r' of undefined [R5CR61EFM5E][15:03:45] [Error] 2024-02-06 20:03:46 194 (func: getImageColor, line: 1175, col: 10) Image Height 533, but use 595 [R5CR61EFM5E][15:03:45] [R:0 S:0] Friends page [R5CR61EFM5E][15:03:45] [R:0 S:0] Nothing to do taskAutoBuyBoxes [R5CR61EFM5E][15:03:45] [R:0 S:0] Starting taskAutoBuyBoxes [R5CR61EFM5E][15:03:45] loop start

My standard settings for the TsumBeta script are Special Screen Ratio, Auto Play Game, SL6, Burst Type, Unlock every 2 hours, Receive all Hearts disabled, receive hearts one by one enabled. Have tried toggling several options, only one that runs without error is disabling everything.

Only thing that seemed to change is Samsung pushing out two updates including the One UI 6.0 update.

mcs commented 5 months ago

I can confirm the issue with Samsung S23, One UI 6.0 and the setting "Special Screen Ratio (Long Screen) (Should start in game)":

16:09:11.231] Calculating screen size
[16:09:11.249] ?? 1920 2340 1080
[16:09:11.277] detect screen size (special screen ratio)
[16:09:11.324] deviceW 1080 deviceH 2340
[16:09:11.371] topBlackY 1170
[16:09:11.400] bottomBlackY 1170
[16:09:11.407] screenHeight 1
[16:09:11.510] Offset (X, Y, H, W) 0 -1170 2340 1080
[16:09:12.772] [R:0 S:0] [TsumTsum] Start
[16:09:13.278] loop start
[16:09:13.467] [R:0 S:0] Friends page
[16:09:13.529] [Error] 2024-02-07 15:09:12 484 (func: getImageColor, line: 980, col: 10) Image Height 780, but use 883
[16:09:13.537] [Error] Run script error: TypeError: Cannot access member 'r' of undefined
[16:09:13.591] [Result] {"result":"Run script error: TypeError: Cannot access member 'r' of undefined","rid":69}

Tested it in latest version and with v57 and both versions raise the same error on script startup.

I currently cannot try starting the script when the game is already open because the Robotmon control bar does not show up while TsumTsum is running. The overlay works fine for other apps liek WhatsApp or Firefox, but with TsumTsum as front app it is now showing. @baggle If that works for you, please try starting the script when the game is fully launched (if that was not the case). Found out that "Game booster" blocked the Robomon control bar. But after the bar was finally there, the error still occured. I'll try to find out what happens behind the scene.

mcs commented 5 months ago

Checking the code and the log I posted before, it really should never happen that topBlackYand bottomBlackY are same and the vertical center of the screen. For me it looks like Samsung somehow prevents Robotmon from taking correct screenshots of the game, resulting in black pixels where none should be. I have no idea if this is due to Samsung or the latest Android 14.

baggle commented 5 months ago

I think you're right that something is up with screenshots. An option inside the Robotmon Simple Service Manager is grabbing a current screenshot of the device. I connected an older phone I have (Huawei Mate 9) and was able to connect/run fine from that.

Checking the screenshot pull from simple manager, Huawei Mate 9 pulls fine: image

Pulling a screenshot from S21U results in garbage data, so screen capture in the script is probably failing due to this: image

mcs commented 5 months ago

That's something that probably cannot be fixed by the script itself. I got a similar result after letting the game create a screenshot via its built-in screenshot API: detectOffsetImg

Sean-Hsueh commented 5 months ago

@baggle @mcs Thanks for all the time invested in the case. Since both v57 & v64 won't work on latest Galaxy ONE UI 6.0, it should be an issue introduced by latest update. Robotmon rely on Android accessibility feature to automate the control, so this might be resolved in the future One UI release (hopefully).

In this case, my suggestion is Tsum script skip the support on current Galaxy UI 6.0, as there are simply too many Android versions for script developers to work on. @baggle Could you please use Emulator on PC before ONE UI resolve the issue?

baggle commented 5 months ago

Thanks @Sean-Hsueh for the reply. I have my workaround in this case to use an older phone (a Huawei Mate 9) with the simple service manager. Funny enough I had moved to running this on physical devices after Nox had quit working for me due to part of that solution relying on 32-bit versions of apps running out of support. I'm open to other emulator suggestions if anything works as well as Nox did before.

mcs commented 5 months ago

I use LDPlayer 5 for running the script plus game.

Sean-Hsueh commented 4 months ago

I use NOX v7.0.1.3 + Android 7 to run Tsum & script :)