LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Getting 3D Slider Value POC

Root / Submissions / [.]

flarn2006Created:
Download:CXDE33D4
Version:Size:
SmileBASIC does not provide any way to read the value of the 3D slider, not that it would be particularly useful. Using the BGSCREEN bug, however, it is possible to read the location in memory (0x1FF81080) where the value is stored. This program reads the background tiles corresponding to that location in memory, parses the floating-point value, and displays it on the screen. The code to get the slider value is in a function, so you can copy and use it in other programs. (Keep in mind the BGSCREEN 0,&H8000000,16 line must be executed before this function will work.) As I said before, reading the 3D slider isn't too useful, but this is really just a proof of concept that you can use the BGSCREEN bug to read a specific, known address in system memory. For anyone interested, the background is stored in memory starting at the lower-left tile, bottom to top, then left to right. Each tile takes up two bytes, and the values start at address 0x87E87F8. To get the correct coordinates, I subtracted that value from the target address (0x1FF81080 - 0x87E87F8 = 0x17798888). That's the number of bytes from the start of the background, so I divided by two to get the number of tiles, which is 0xBBCC444. Now, each column is 16 tiles, and conveniently, hexadecimal is base 16. So the last digit corresponds to the Y coordinate, and the other digits are the X coordinate. And since the Y coordinate is from the bottom while the coordinates you enter are from the top, you need to subtract that from 15. So the X coordinate is 0xBBCC44 (or &HBBCC44 in SmileBASIC notation) and the Y coordinate is (15-4=)11. Since the value is 4 bytes long, I also had to get the next two bytes, from the tile above that one. (0xBBCC44, 10)

Instructions:

1. Make sure you've saved anything you don't want to lose, just in case SmileBASIC crashes. 2. Run the program. 3. Read and accept the warning message. 4. Move the 3D slider and watch the value on the screen change.

Replying to:12Me21
Could someone download this and give me the code? I still have 3.3.1, and I want to try this program before DHLPTX is fully dead.
No problem

Replying to:12Me21
Could someone download this and give me the code? I still have 3.3.1, and I want to try this program before DHLPTX is fully dead.
I made a pong game that uses the 3D slider to control your paddle EDIT: I just had an idea, what if the slider moved in the Z axis, and... ok that is not a great idea, maybe

much shorter float decoder:
VAR SIG#=(((HIGH%<<16) OR LOW%) AND &H7FFFFF)/&H7FFFFF+1
IF HIGH% AND &HF8000 THEN SIG#=-SIG#
RETURN SIG#*POW(2,((HIGH% AND &H7F80)>>7)-127)