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.

I can think of one use: creating a pop-up book, for storytelling.

Replying to:Gale_Storm
I can think of one use: creating a pop-up book, for storytelling.
You can already use the depth display, you just don't know if the user is viewing it.

Have you experienced the program crashing? I can see this being incredibly useful as another input method (Like the buttons & touchscreen). (edit) Aaaaaannndd it just crashed lol.

I should note that the SmileBoom President has confirmed that this bug will be patched in the next update. It's too bad, it had some potential for cool stuff like this. (Also it seems that the memory addresses might move around between updates, and even have variable size regions that make it unstable based on previous use.) Semi-relevant: https://lumage.smilebasicsource.com/special/dhlptx/memorymap.html

@MZ952 i think you need the 3d slider on before you start the program for it to work

Replying to:Yolkai
I should note that the SmileBoom President has confirmed that this bug will be patched in the next update. It's too bad, it had some potential for cool stuff like this. (Also it seems that the memory addresses might move around between updates, and even have variable size regions that make it unstable based on previous use.) Semi-relevant: https://lumage.smilebasicsource.com/special/dhlptx/memorymap.html
If there is demand for simple features like this we can check with a memory hack, we should just be filing them on the official feature requests anyway. (Of course, they don't have to listen.)

Replying to:User1_
@MZ952 i think you need the 3d slider on before you start the program for it to work
No it had worked, I started meddling with the code to see how unstable it might be. I got as far as calling "XSCREEN 3" before it crashed.

Replying to:User1_
@MZ952 i think you need the 3d slider on before you start the program for it to work
XSCREEN 3 disables the 3D mode, so that might explain it.

Replying to:User1_
@MZ952 i think you need the 3d slider on before you start the program for it to work
i let it crash first and after that it worked

Replying to:Yolkai
I should note that the SmileBoom President has confirmed that this bug will be patched in the next update. It's too bad, it had some potential for cool stuff like this. (Also it seems that the memory addresses might move around between updates, and even have variable size regions that make it unstable based on previous use.) Semi-relevant: https://lumage.smilebasicsource.com/special/dhlptx/memorymap.html
While it's a shame, it was inevitable anyway. As is always the case when a bug is used as an entry point for the Homebrew Launcher.

Replying to:MZ952
Have you experienced the program crashing? I can see this being incredibly useful as another input method (Like the buttons & touchscreen). (edit) Aaaaaannndd it just crashed lol.
It just crashed for me when I ran it after downgrading to 3.2.1. My guess is that the base address for the background is different on that version.

This is pretty awesome. It sucks they're going to patch it. It would be useful for 3D games to automatically adjust the 3D effect based on the slider.

Replying to:amihart
This is pretty awesome. It sucks they're going to patch it. It would be useful for 3D games to automatically adjust the 3D effect based on the slider.
Really, hopefully they'll add SLIDER OUT VOLUME, DEPTH so we could access the volume and 3d sliders as inputs. That might be useful for some games. Imaging having to actually play a game with the volume slider, haha :D But the 3D slider would actually be useful, so at least that one would be nice :)

Replying to:amihart
This is pretty awesome. It sucks they're going to patch it. It would be useful for 3D games to automatically adjust the 3D effect based on the slider.
Yep. I was looking for a feature like this when I made my Ringman game. You have to change the depth slider and press a button to toggle the 3D effect since I can't actually detect the 3D slider change. So I disagree with this feature not being "particularly useful" as written in the description. It's pretty much a necessary feature imo.

Replying to:amihart
This is pretty awesome. It sucks they're going to patch it. It would be useful for 3D games to automatically adjust the 3D effect based on the slider.
You should suggest it on the secret Miiverse thing that no one can ever find

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.

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.
DEF GET3D()
W1%=BGGET(0,&HBBCC44,10)
W2%=BGGET(0,&HBBCC44,11)
SWAPPED%=&H10000*W1%+W2%
BIT%=&H400000
BITVAL=0.5
SIG=1
FOR I=1 TO 32
IF(SWAPPED% AND BIT%)>0 THEN
INC SIG,BITVAL
ENDIF
BIT%=BIT% DIV 2
BITVAL=BITVAL/2
NEXT I
EXP%=(W1% AND &H7F80) DIV &H80
DEC EXP%,127
IF (W1% AND &H8000)>0 THEN SIG=-SIG
RETURN SIG*POW(2,EXP%)
END
If it doesn't work, let me know, i could have screwed up somewhere.

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.
thanks

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.
You could always use CIAs from CIAngel to use this

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.
The code works, thanks