? Getting 3D Slider Value POC ● SmileBASIC Source

Sign In

Register
*Usernames are case-sensitive
Forgot my password
💀

Getting 3D Slider Value POC

Submitted
Updated
Author
flarn2006
Public Key
CXDE33D4
Min. Compat.
All
Rating
3 votes
Description 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.
Categories
Keywords
23 Comment(s) 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website 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) 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website 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. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies 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. 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website thanks AnswerXOX AnswerXOX Great Page Hidden Achievements RNG Hidden Easter Eggs Second Year My account is over 2 years old Website You could always use CIAs from CIAngel to use this 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website The code works, thanks MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies No problem 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website 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 amihart 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. Minxrod Minxrod Summer 2016 Contest Participant I participated in the SmileBASIC Source Summer 2016 Contest! Programming Contest Expert Programmer Programming no longer gives me any trouble. Come to me for help, if you like! Programming Strength Pokemon Is Awesome! I love Pokemon! Express Yourself 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 :) amihart amihart 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. 12Me21 12Me21 Admin Syntax Highlighter Received for creating the code syntax highlighter on SBS Night Person I like the quiet night and sleep late. Express Yourself Second Year My account is over 2 years old Website You should suggest it on the secret Miiverse thing that no one can ever find User1_ User1_ First Week Joined in the very first week of SmileBASIC Source Website Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Night Person I like the quiet night and sleep late. Express Yourself @MZ952 i think you need the 3d slider on before you start the program for it to work MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies 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. snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements OSP Contest 2 Contest Participant I participated in the second SmileBASIC Source OSP Contest! Night Person I like the quiet night and sleep late. Express Yourself XSCREEN 3 disables the 3D mode, so that might explain it. User1_ User1_ First Week Joined in the very first week of SmileBASIC Source Website Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself Night Person I like the quiet night and sleep late. Express Yourself i let it crash first and after that it worked Y_ack Y_ack Head Admin 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 snail_ snail_ Helper Received for being very helpful around SmileBASIC Source Achievements OSP Contest 2 Contest Participant I participated in the second SmileBASIC Source OSP Contest! Night Person I like the quiet night and sleep late. Express Yourself 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.) flarn2006 flarn2006 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. MZ952 MZ952 Intermediate Programmer I can make programs, but I still have trouble here and there. Programming Strength Drawing I like to draw! Hobbies Reading I like to read books! Hobbies 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. flarn2006 flarn2006 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. Gale_Storm Gale_Storm Video Games I like to play video games! Hobbies Night Person I like the quiet night and sleep late. Express Yourself Zelda Is Awesome! I love The Legend Of Zelda! Express Yourself I can think of one use: creating a pop-up book, for storytelling. Y_ack Y_ack Head Admin You can already use the depth display, you just don't know if the user is viewing it.