if usb==1 then
System.usbDiskModeActivate()
screen:blit(1, 3, usba)
end
if usb==0 then
System.usbDiskModeDeactivate()
end
pad = Controls.read()
if pad:select() then
screen.waitVblankStart(20)
if usb==1 then
usb = 0
else
usb = 1
end
-- a function to toggle usb mode
function toggleUSB()
if usb==0 then
System.usbDiskModeActivate()
screen:blit(1, 3, usba)
usb = 1
else
System.usbDiskModeDeactivate()
usb = 0
end
end
-- the rest of this should be in your main loop
pad = Controls.read()
if pad:select() then
toggleUSB()
end