|
#1
|
||||
|
||||
|
After Zaffo found that iago1460's event-test tool contradicts my findings, I have to reject my conclusion and change this thread into an investigation thread.
"Findings" section - contains information that is found to be working. "Testings" section - contains current investigations and questions. Findings at idle shutdown 1 Code without control.isButton() freezes. Code:
screen.fillrect(0,0,400,240,color.new(0,0,0)) text.color(color.new(255,255,255)) ts=16 text.size(ts) while true do screen.fillrect(100,100,200,20,color.new(0,0,0)) text.draw(100,100,tostring(os.date())) screen.update() if control.read()==1 then if control.isTouch()==1 then if touch.click()==1 then break end end else os.wait(50) end end Code with button.click()==1 then break closes properly on idle shutdown. Code:
screen.fillrect(0,0,400,240,color.new(0,0,0)) text.color(color.new(255,255,255)) ts=16 text.size(ts) while true do screen.fillrect(100,100,200,20,color.new(0,0,0)) text.draw(100,100,tostring(os.date())) screen.update() if control.read()==1 then if control.isButton()==1 then if button.click()==1 then break end end else os.wait(50) end end When button.click results in another loop, app is also closed properly. (see post #5) 4 iago1460's Tool does shut down properly without having a break under if button.click()==1. I played around with this information under Testings. Testings After putting an os.wait(500) in the loop, iago1460's tool allowed me to read the event on the screen when the player does idle shutdown: Code:
button event:0:[home]:[click] After that the app closes properly. While a button.click does nothing to this app besides text.drawing the event that has happened, somehow the app did close. Thoughts:thought 1: testscript Findings 1 now contains a useless button.click: Code:
screen.fillrect(0,0,400,240,color.new(0,0,0)) text.color(color.new(255,255,255)) ts=16 text.size(ts) while true do screen.fillrect(100,100,200,20,color.new(0,0,0)) text.draw(100,100,tostring(os.date())) screen.update() if control.read()==1 then if control.isTouch()==1 then if touch.click()==1 then break end elseif control.isButton()==1 then if button.click()==1 then text.draw(0,0,"buttonclick") screen.update() end end else os.wait(50) end end "buttonclick" shows on screen doesn't go back to app menu player freezes. To resemble the event-test tool, test script from findings 1 now contains control.read(1)==1, and therefore I can remove the else os.wait(50) Code:
screen.fillrect(0,0,400,240,color.new(0,0,0)) text.color(color.new(255,255,255)) ts=16 text.size(ts) while true do screen.fillrect(100,100,200,20,color.new(0,0,0)) text.draw(100,100,tostring(os.date())) screen.update() if control.read(1)==1 then if control.isTouch()==1 then if touch.click()==1 then break end end end end Doesn't go back to app menu. Player shuts down properly. Black Jack: added: control.read(1)==1 Code:
while (1) do for i = 0, 10 do if (control.read(1)==1) then if (control.isTouch()==1) then x,y = touch.pos() if (touch.click() == 1) then checkClick(x,y) elseif(touch.move() == 1) then checkMove(x,y) end elseif (control.isButton()==1) then if button.click() == 1 then ask = true --Activate settings screen prompt = "Quit?" --Set prompt message if (sound == true) then --If not muted press:play() --Play button sound end elseif (button.hold() ==1) then volume = true --activate volume menu if (sound == true) then --If not muted press:play() --Play button sound end end end end end if (quit == true) then os.wait(500) break end drawScreen() os.sleep(1) end (I cripped the game doing this, it now only responds after a few clicks, and then it has skipped a few steps. I'm not sure why actually.. it seems like control.read(1) forces the loop to wait until there is an input?) "Quit?" prompt didn't appear doesn't go back to app menu player shuts down properly Thoughts:Conclusions -idle shutdown sends a buttonclick to the app - Solutions 1 (more of a workaround) Code to shutdown the app after 4 minutes (to prevent the app from having to idle shutdown and cause problems) Code:
starttime=os.time() while true do if control.read()==1 then starttime=os.time() else if os.time()-starttime>240 then --checks is it was more than 240 seconds ago since the last control.read input. break end end end Notes Hopefully this will get sorted out so I can post something that will work in any case. Last edited by Brett_val; 04-19-2010 at 12:54 PM. |
|
|
|||
|
|
|
#2
|
||||
|
||||
|
I noticed this on my Black Jack app too when testing it, but I didn't connect the dots. Problem is that I'd still like to keep my confirmation screen.
One thing also, when playing sudoku it returns to the menu if you're in a game, so wouldn't that freeze too if you leave it in a game? EDIT1: Could it be so that it sends a few button clicks, not just one? In that case I could solve it for my app at least. I would suspect this is the case if Sudoku doesn't freeze. EDIT2: Another idea struck me. What if the thing which is causing the freezing is that it keeps sending button.click() commands until the application closes? And since it never does the player hangs in an eternal loop. Sounds plausible and could easily be tested too. It'd be good if we could get some other kind of signal for it which is separate from any other so we can program an "In case of idle shut down" function.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#3
|
||||
|
||||
|
Quote:
Quote:
Code:
if button.click()==1 then break end Code:
if control.isButton()==1 then break end But sudoku doesn't go back to the main menu at my player..? I just tried it; started a game, typed some numbers, then homebutton - exits the app. I'll update my firmware to 1.20.08, maybe the change is there.. Quote:
Well you can't do too much when it wants to idle shutdown. I noticed that the saving of the highscore I do at the end of ZenDuck already is too much.. (even when I deleted the closing animation I have at the end). |
|
#4
|
||||
|
||||
|
Maybe sudoku doesn't, I thought it did though. (didn't try before stating it) I blame my memory.
Making an auto shut-down for the application could work indeed. Though it'd be perfect if we could know what idle shut-down time the player is set to. I'll look into this and see if I can come up with something for Black Jack with this.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#5
|
||||
|
||||
|
So this script requires two buttonclicks to close
Code:
screen.fillrect(0,0,400,240,color.new(0,0,0)) text.color(color.new(255,255,255)) ts=16 text.size(ts) while true do screen.fillrect(100,100,200,20,color.new(0,0,0)) text.draw(100,100,tostring(os.date())) screen.update() if control.read()==1 then if control.isButton()==1 then if button.click()==1 then while true do if control.read()==1 then if control.isButton()==1 then if button.click()==1 then break end end else os.wait(50) end end break end end else os.wait(50) end end I left this running, and after 5 minutes it said "idle shutdown". Then it didn't go back to the players application menu, but stayed in the app, and then said "shutting down". Player shut down and restarting it didn't require a disc scanning. So yeah, the player will probably send another buttonclick if the app didn't close the first time. Ofcourse I got curious and added the requirement for another click: Code:
while true do screen.fillrect(100,100,200,20,color.new(0,0,0)) text.draw(100,100,tostring(os.date())) screen.update() if control.read()==1 then if control.isButton()==1 then if button.click()==1 then while true do if control.read()==1 then if control.isButton()==1 then if button.click()==1 then while true do if control.read()==1 then if control.isButton()==1 then if button.click()==1 then break end end else os.wait(50) end end break end end else os.wait(50) end end break end end else os.wait(50) end end I left this running again, and after 5 minutes the same thing happens. It's very plausible that the freezing is in fact due to the player sending buttonclicks to the app, but the app is not responding to it. Good thinking Habhome! But then I'm still left with the ZenDuck problem.. Even one buttonclick is enough to close it, but still it freezes. And in the situation I described in the first post, it would have closed after two buttonclicks. Maybe it's because the app was doing too much after it received the buttonclick? |
|
#6
|
||||
|
||||
|
Habhome, I tried to fix Black Jack, by adding this:
Code:
if button.click() == 1 then if ask then quit = true end ask = true --Activate settings screen prompt = "Quit?" --Set prompt message But still, when it tries to idle shutdown it freezes. So I guess it's not as simple as multiple buttonclicks.. or do you have another suggestion for Black Jack's code? |
|
#7
|
||||
|
||||
|
I see, with this information I'll be able to make Black Jack not freeze, I think. Unless I run into the same problem as you since mine also performs some actions during shut down. I'll ell you if I find a solution to it.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#8
|
||||
|
||||
|
Quote:
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#9
|
|||
|
|||
|
Strange thing is - IMO - that when you hold the power button during the game the player shuts down without a problem. Why is the shut down procedure after idle time different?
If it was to save some scores or end the program in the way the programmer intended they would have given it some more time before it would give up and freeze. I tested idle shutdown in my snake game. If you are in the game and use the home-button your score it shown on screen for ~0.3 seconds after which you are directed to the menu. When you are in a menu and use the home-button the game ends. So you need the home button 2 times to exit the game while playing, which will take just over 0.3 seconds. This seems to be too much and the player freezes. Idle shutdown from the menu works fine. So Creative could solve this in 2 ways: 1. Use the same method for idle shutdown as is used for power button hold shutdown. 2. Give more time before freeze. Best would be to combine these and first try the home button for about 2 seconds and then use point 1 above. How can we solve this? If the multiple click = immediate close of program doesn't work I have no clew. I'm running this tool (iago1460s Test tool v0.1) now to see what it gives me. Edit: Strange, no freeze there while the program doesn't shut down with the home button (only when touching the upper left corner of the screen).
__________________
Snake for the X-Fi2 Last edited by Zaffo; 04-17-2010 at 05:34 AM. Reason: player idle shutdown complete :) |
|
#10
|
||||
|
||||
|
Hm, the notion about exit time is interesting. Maybe someone could make a app similar to Brett's test apps with different delays and see when/if it freezes? I would myself but I'm busy programming my Sumo Robot and going to test it today before the Swedish Championships tomorrow.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#11
|
||||
|
||||
|
Thanks Zaffo, you totally broke down my conclusion and I updated the first post to try to approach what is really happening.
From what I've found until now, I think the os.wait plays a major role in this.. I updated the first post with some testing I did. |
|
#12
|
||||
|
||||
|
I did some experiments with Black Jack and I believe I'm close to a solution.
First of all I simply changed the os.sleep(1) I had in the main loop to os.wait(10). Now it displays the "Idle shut down" message, but it still freezes after that. One thing that came to mind then was that it perhaps has something to do with me having the draw function in the main game loop. I think that a solution to this would be to prevent the player from drawing to the screen always, and only when something should be changed. I came to think of this when I tested with Tetrajak's Crystal Connect, which has a confirm screen but still didn't freeze. I'll do some testing with this in my Black Jack game when I get some spare time, it'll require quite a bit of rewriting of my code and I have a bunch of tests coming up, most of them important national exams. But I wanted to throw it out there since it may provide a solution.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#13
|
||||
|
||||
|
Sorry about the double post, but I just wanted to inform you of my latest findings.
The drawing is probably not much of an issue, I didn't manage to solve it by manipulating that. Something which did work to fix this for my Black Jack game though was to divide it into multiple game loops where I use a confirm dialog function which I got inspired to make when reading Tetrajak's code, which contains its own loop for checking for button presses. So now my Black Jack app also shut down when idle shut down kicks in on the player. (The bugfix will be uploaded later when I've done some cleaning of the code in a similar fashion)
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#14
|
|||
|
|||
|
After deleting the os.sleep() after the home button press during the game, and putting the os.sleep() in the menu after an if statement that disables it on game exit, my snake game shuts down properly.
After 5 minutes in the game I see a message with "Idle shutdown". The game goes to the menu. Then I get a "Shutting Down" message after which the player is off. I quess this all takes approximately 1 to 2 seconds. But it works the way it should be. It looks like it takes the same route through the code as when you would use the home button the exit the game and the menu. At least this means that before shutting down there can be code to write to a file, draw a menu, etc.
__________________
Snake for the X-Fi2 |
|
#15
|
||||
|
||||
|
I'm not sure if you can save to files. My code should be going through that on shut down, but it doesn't save.
__________________
"If you are good enough at English to apologize, then there is no need to." - A good friend of mine Discovered something about the X-Fi2 you think others may not know? Post it here so others can learn about it! Have a question about X-Fi2 apps? Consult the FAQ before creating a thread about it. Like my work? Tell your friends. Don't like it? Tell me so I can improve. ^.^ |
|
#16
|
|||
|
|||
|
In that case it looks like it walks through the code but it ignores some parts. I can think of any reason why that would be the case, but it looks like it. But in that case I find it strange that I go through the menu in my snake. As it is in an another loop than the game and the menu is drawn by a function. Al of which seem to be opened.
It's a shame idle shutdown isn't supported by the sim.
__________________
Snake for the X-Fi2 |
|
#17
|
||||
|
||||
|
Quote:
Notepad doesn't crash and can even save the file, and it has an else os.sleep(2) in the main loop, but no function calling. Maybe that's just enough. I think it's a time-running-out issue, so wait's are a waste of time then . I guess it could perhaps ignore parts of the code when the app is not in a loop anymore... Haha yeah testing this is pretty time consuming
|
![]() |
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 12:54 PM.












.
Linear Mode
