[Release] Vita Hardware Test

Discussion in 'PS Vita - Hacking & Homebrew' started by ifrit05, Aug 13, 2016.

Aug 13, 2016

[Release] Vita Hardware Test by ifrit05 at 2:14 AM (3,188 Views / 6 Likes) 10 replies

  1. ifrit05
    OP

    Newcomer ifrit05 Advanced Member

    Joined:
    Aug 11, 2014
    Messages:
    68
    Country:
    United States
    Last edited by ifrit05, Aug 13, 2016
    satan89, zfreeman, Madridi and 3 others like this.
  2. naughtyotsel

    Member naughtyotsel GBAtemp Regular

    Joined:
    Jul 17, 2016
    Messages:
    126
    Country:
    Slovakia
    whats the purpose of this homebrew?:unsure:
     
  3. Voxel

    Member Voxel Unity Junkie

    Joined:
    Jun 27, 2015
    Messages:
    5,051
    Location:
    England, UK
    Country:
    United Kingdom
    Looks like a button/screen tester, as well as a battery measure in the top-right.

    Great work seeing this though; it's great to see more homebrew pouring into the scene! :)
     
  4. ifrit05
    OP

    Newcomer ifrit05 Advanced Member

    Joined:
    Aug 11, 2014
    Messages:
    68
    Country:
    United States
    Thanks. It took so much work to get those shoulder buttons colored in.
     
    Voxel likes this.
  5. Seya16

    Newcomer Seya16 Newbie

    Joined:
    Aug 14, 2016
    Messages:
    1
    Country:
    Belgium
    Does not the Vita Tester by Smoke doing the same thing ?
     
  6. DinohScene

    Member DinohScene Feed Dino to the Sharks

    Joined:
    Oct 11, 2011
    Messages:
    14,277
    Location:
    В небо
    Country:
    Antarctica
    Sweet.

    Any homebrew is welcomed.
    Even if it's the same someone else made.
     
  7. PSSceneIsBestScene

    Newcomer PSSceneIsBestScene Member

    Joined:
    Sep 23, 2015
    Messages:
    14
    Country:
    Turkmenistan
    You could mention that you copied SMOKE's work and improved on it, instead of pretending it is all your work.
    Releases are nice, but you should always give props to the person or software that helped you release yours, it is the courteous thing to do.
    Doing so will make it so we avoid things like this:

    https://twitter.com/SMOKE587/status/764601221529362433
     
    Zeroba likes this.
  8. dfsa3fdvc1

    Member dfsa3fdvc1 GBAtemp Regular

    Joined:
    Jan 3, 2015
    Messages:
    228
    Country:
    Albania
    I've made a slight improvement to the tester. Cleaned the way directories are handled
    I've made it so that touch screen input is drawn onto the onscreen vita image proportionally. So if you're touching the top right part of your screen it's drawn on the top right of the virtual vita.

    For convenience I'm going to copy paste my entire index.lua but the relevant lines about the touch screen (near the very bottom) are
    if(tx1 + ty1 > 0) then
    Graphics.fillCircle( (tx1*( (769-189)/Scr.w) )+168+21 , (ty1*( (469-146)/Scr.h) )+150-3 ,radius, white) --the +21 and -3 is some magic to fix some unknown problem..
    end;

    I've only been able to test this on a vita TV using the virtual touchscreen input with a dualshock but it should work on all Vitas.
    Perhaps this could be a replacement for the x1, y2, debug text output.

    And suggestion, change the whitenoise audio clip to something like a piano scale ascending and descending. White noise is probably what a BROKEN vita would sound like.

    Code:
    ----------------------------------------
    -- Vita Hardware Test v1.0 by @SMOKE587 --
    ----------------------------------------
    
    Scr = { w = 960,	--The screen resolution of the vita screen 960x544
    		h = 544};
    		
    -- init  colors
    white		= Color.new(255,255,255,255)
    yellow		= Color.new(255,255,0,255)
    
    red			= Color.new(255,0,0,255)
    lightred	= Color.new(255,102,102,255)
    
    blue		= Color.new(0,0,255,255)
    lightblue	= Color.new(102,102,255,255)
    
    imgDir	= "app0:/res/img/"
    sndDir	= "app0:/res/snd/"
    
    radius=10
    
    -- init images 
    mainbg		= Graphics.loadImage(imgDir .. "mainbg.png")
    crossimg	= Graphics.loadImage(imgDir .. "cross.png")
    squareimg	= Graphics.loadImage(imgDir .. "square.png")
    circleimg	= Graphics.loadImage(imgDir .. "circle.png")
    triangleimg	= Graphics.loadImage(imgDir .. "triangle.png")
    startimg	= Graphics.loadImage(imgDir .. "start.png")
    selectimg	= Graphics.loadImage(imgDir .. "select.png")
    rtrigimg	= Graphics.loadImage(imgDir .. "rtrig.png")
    ltrigimg	= Graphics.loadImage(imgDir .. "ltrig.png")
    upimg		= Graphics.loadImage(imgDir .. "up.png")
    downimg		= Graphics.loadImage(imgDir .. "down.png")
    leftimg		= Graphics.loadImage(imgDir .. "left.png")
    rightimg	= Graphics.loadImage(imgDir .. "right.png")
    battlow		= Graphics.loadImage(imgDir .. "battlow.png")
    batt2550	= Graphics.loadImage(imgDir .. "batt2550.png")
    batt5075	= Graphics.loadImage(imgDir .. "batt5075.png")
    batt75100	= Graphics.loadImage(imgDir .. "batt75100.png")
    battcharge	= Graphics.loadImage(imgDir .. "battcharge.png")
    
    -- init short button names
    cross		= SCE_CTRL_CROSS
    square		= SCE_CTRL_SQUARE
    circle		= SCE_CTRL_CIRCLE
    triangle	= SCE_CTRL_TRIANGLE
    start		= SCE_CTRL_START
    selct		= SCE_CTRL_SELECT
    rtrigger	= SCE_CTRL_RTRIGGER
    ltrigger	= SCE_CTRL_LTRIGGER
    up			= SCE_CTRL_UP
    down		= SCE_CTRL_DOWN
    left		= SCE_CTRL_LEFT
    right		= SCE_CTRL_RIGHT
    
    -- init sound
    Sound.init() 
    sndtest = Sound.openOgg(sndDir .. "sndtest.ogg")
    Sound.play(sndtest, LOOP)
    
    -- main loop
    while true do
    	
    	-- init sticks/touch stuff
    	rx,ry					= Controls.readRightAnalog()
    	lx,ly					= Controls.readLeftAnalog()
    	tx1,ty1,tx2,ty2		= Controls.readTouch() 
    	rtx1,rty1,rtx2,rty2	= Controls.readRetroTouch() 
    	
    	-- prevent nil concatenation
    	if tx2 == nil then
            tx2 = 0
            ty2 = 0
            if tx1 == nil then
                tx1 = 0
                ty1 = 0
            end
        end
        
    	-- ditto
        if rtx2 == nil then
            rtx2 = 0
            rty2 = 0
            if rtx1 == nil then
                rtx1 = 0
                rty1 = 0
            end
        end
    	
    	-- init screen
    	Graphics.initBlend()
    	Screen.clear()
    	
    	--init ui
    	Graphics.drawImage(0, 0, mainbg)
    	Graphics.debugPrint(0, 0, "Vita Hardware Test v1.0 by @SMOKE587", yellow)
    	Graphics.debugPrint(0, 30, "LStick X: " .. lx .. " - LStick Y: " .. ly .. " - RStick X: " .. rx .. " - RStick Y: " .. ry .."\nScreen X1: " .. tx1 .. " - Screen X2: " .. tx2 .. " - Screen Y1: " .. ty1 .. " - Screen Y2: "	.. ty2 .."\nRetro X1: " .. rtx1 .. " - Retro X2: " .. rtx2 .. " - Retro Y1: " .. rty1 .. " - Retro Y2: " .. rty2, white)
    	Screen.flip()
    
    	-- check for button input
    	if Controls.check(Controls.read(), cross) then
    		Graphics.drawImage(0, 0, crossimg)
    	end
    	if Controls.check(Controls.read(), square) then
    		Graphics.drawImage(0, 0, squareimg)
    	end
    	if Controls.check(Controls.read(), circle) then
    		Graphics.drawImage(0, 0, circleimg)
    	end
    	if Controls.check(Controls.read(), triangle) then
    		Graphics.drawImage(0, 0, triangleimg)
    	end
    	if Controls.check(Controls.read(), start) then
    		Graphics.drawImage(0, 0, startimg)
    	end
    	if Controls.check(Controls.read(), selct) then
    		Graphics.drawImage(0, 0, selectimg)
    	end
    	if Controls.check(Controls.read(), rtrigger) then
    		Graphics.drawImage(0, 0, rtrigimg)
    	end
    	if Controls.check(Controls.read(), ltrigger) then
    		Graphics.drawImage(0, 0, ltrigimg)
    	end
    	if Controls.check(Controls.read(), up) then
    		Graphics.drawImage(0, 0, upimg)
    	end
    	if Controls.check(Controls.read(), down) then
    		Graphics.drawImage(0, 0, downimg)
    	end
    	if Controls.check(Controls.read(), left) then
    		Graphics.drawImage(0, 0, leftimg)
    	end
    	if Controls.check(Controls.read(), right) then
    		Graphics.drawImage(0, 0, rightimg)
    	end
    	
    	-- init battstats
    	battpercent = System.getBatteryPercentage()
    	if System.isBatteryCharging() then
    		Graphics.drawImage(0, 0, battcharge)
    	elseif battpercent >= 75 then
    		Graphics.drawImage(0, 0, batt75100)
    	elseif battpercent >= 50 then
    		Graphics.drawImage(0, 0, batt5075)
    	elseif battpercent >= 25 then
    		Graphics.drawImage(0, 0, batt2550)
    	else Graphics.drawImage(0, 0, battlow)
    	end
    	
    	----TOUCH---
    	if(tx1 + ty1 > 0) then
    		Graphics.fillCircle( (tx1*( (769-189)/Scr.w) )+168+21 ,  (ty1*( (469-146)/Scr.h) )+150-3 ,radius, red)  --the +21 and -3 is some magic to fix some unknown problem..
    	end;
    	
    	if(tx2 + ty2 > 0) then
    		Graphics.fillCircle( (tx2*( (769-189)/Scr.w) )+168+21 ,  (ty2*( (469-146)/Scr.h) )+150-3 ,radius, lightred)  --the +21 and -3 is some magic to fix some unknown problem..
    	end;
    	------
    	
    	----REAR------- NOTE REAR TOUCH Y AXIS WAY OFF
    	if(rtx1 + rty1 > 0) then
    		Graphics.fillCircle( (rtx1*( (769-189)/Scr.w) )+168+21 ,  (rty1*( (469-146)/Scr.h) )+150-3 ,radius, blue)  --the +21 and -3 is some magic to fix some unknown problem..
    	end;
    	
    	if(rtx2 + rty2 > 0) then
    		Graphics.fillCircle( (rtx2*( (769-189)/Scr.w) )+168+21 ,  (rty2*( (469-146)/Scr.h) )+150-3 ,radius, lightblue)  --the +21 and -3 is some magic to fix some unknown problem..
    	end;
    	------
    	
    	Screen.flip()
    	Graphics.termBlend()
    
    end
    I wonder if it would be possible to detect what kind of Vita is being used. If it's a original, slim, or TV. That would be cool.
     
    Last edited by dfsa3fdvc1, Aug 15, 2016
  9. ifrit05
    OP

    Newcomer ifrit05 Advanced Member

    Joined:
    Aug 11, 2014
    Messages:
    68
    Country:
    United States
    I never even touched his app or seen it before. I was just messing around and having fun learning Lua.

    I spent a week creating this app from scratch (with no prior Lua experience).

    If he thinks I stole or "copied" he can P.M. me or post here and we can talk it out.

    Wait, are you SMOKE?
    If so I was going to attempt to creat a Stuck/Dead Pixel fixer but you already made that? Well, guess that's out of the question...
     
    Last edited by ifrit05, Aug 15, 2016
  10. dfsa3fdvc1

    Member dfsa3fdvc1 GBAtemp Regular

    Joined:
    Jan 3, 2015
    Messages:
    228
    Country:
    Albania
    No, I'm just messing with you

    @PSSceneIsBestScene it's pretty dumb that Smoke is complaining that someone else made a button tester. First the one in this thread uses LPP and Smoke's uses the Vita SDK so it's not possible for them to be direct copies. If Smoke is really going to get upset that someone did something similar he should have gone out of his way to make something not so generic.
    It's totally understandable that someone else would make something like this even if they had never seen Smoke's button tester.
     
  11. ifrit05
    OP

    Newcomer ifrit05 Advanced Member

    Joined:
    Aug 11, 2014
    Messages:
    68
    Country:
    United States
    Me and SMOKE talked it out. Everything is good. Please don't think he's pissed off. I don't want him to think I'm letting you guys think he's an a**hole. :)

    Oh thank you for that awesome addition to the code. If, I choose to go any further with this, can I use your additions with accreditation to you?
     
    Last edited by ifrit05, Aug 15, 2016
    PSSceneIsBestScene likes this.

Share This Page