Rockbox Technical Forums

Support and General Use => User Interface and Voice => Topic started by: Mmmm on September 16, 2005, 07:23:04 AM

Title: UISimulator
Post by: Mmmm on September 16, 2005, 07:23:04 AM
I am able to compile the code but I dont know how to use the simulator. I assume that when compiling you have to choose a simulator build but what then? Are there any instructions about this? I couldn't find any on the WIKI.
Title: Re: UISimulator
Post by: tucoz on September 16, 2005, 07:46:41 AM
Have you had a look at this page?
http://www.rockbox.org/docs/uisimulator.html
Title: Re: UISimulator
Post by: Mmmm on September 16, 2005, 09:24:34 AM
Aha.. thanks Tukoz the one place i didnt look was in the docs! ::)

So just to get this straight.... i need to
i) download the uisimulator folder using CVS
ii) compile as usual but choose simulator build
iii) instead of 'make zip' to create the zip file i type 'make install'
iv) fill up the subdirectory with music, jpgs cfg files etc
v) type rockboxui in the compiled directory

and i'm away... does this sound right?
Title: Re: UISimulator
Post by: AlexP on September 16, 2005, 10:11:15 AM
Aha.. thanks Tukoz the one place i didnt look was in the docs! ::)

So just to get this straight.... i need to
i) download the uisimulator folder using CVS
ii) compile as usual but choose simulator build
iii) instead of 'make zip' to create the zip file i type 'make install'
iv) fill up the subdirectory with music, jpgs cfg files etc
v) type rockboxui in the compiled directory

and i'm away... does this sound right?

Yep, that's it - I've just tried it myself (it must be fairly easy then!) and it's fantastic to be able to see my WPS and fiddle without repeatedly connecting and disconnecting my iRiver!
Title: Re: UISimulator
Post by: Mmmm on September 16, 2005, 10:17:32 AM
Brilliant... I cant wait to get home and try it then... now for a bit of clock watching................
Title: Re: UISimulator
Post by: Mmmm on September 16, 2005, 02:22:05 PM
OK, I've tried it and it seems to be alright but it doesn't actually play the files, it just sits there at 0.00. Ffd and rwd work fine but it won't progress through the track on its own!

What have i done wrong? I chose win32 because i'm running windows, is that right?

 ???
Title: Re: UISimulator
Post by: AlexP on September 16, 2005, 02:58:49 PM
I also selected Win32 for Windows, and likewise it doesn't actually play the track - I suspect it's something to do with the simulator not having the capacity to access your hardware.  It shows Ffd and Rwd fine though, probably just simulating what would happen without actually playing it.

I must stress, all the above is a guess!  Maybe someone with more in depth knowledge (perhaps Daniel Stenberg, I seem to remember him saying he wrote it - sorry if wrong) could explain what it actually does?
Title: Re: UISimulator
Post by: Bagder on September 16, 2005, 04:48:23 PM
Yes, I wrote the initial (and most other) X11 parts of it. I also recently added the music playback abilities to the X11 (linux/cygwin) version. I don't run windows and I don't develop on windows so win32 things is generally beyond me.

If it doesn't play sound for you, then start figuring out why and fix it!

Things don't always fix themselves by magic you know.
Title: Re: UISimulator
Post by: Mmmm on September 16, 2005, 05:09:09 PM
I don't develop on windows so win32 things is generally beyond me.

oh...that's a shame.. :(

If it doesn't play sound for you, then start figuring out why and fix it!
Believe me, if its beyond you then I really dont have even the faintest inkling of a chance !;)

I don't suppose thare is any possible way of using the X11 parts on windows is there?

Now I just know that was a silly question! ;D

Maybe the time has come to dump windows! ;D
Title: Re: UISimulator
Post by: Mmmm on September 16, 2005, 05:22:03 PM
I also have a couple more questions....

Is it possible to simulate the hold button?
Is it possible to simulate plugging in the charger?
and finally how does it decide on the battery level and can I change it?

Title: Re: UISimulator
Post by: kenshin on September 16, 2005, 06:20:43 PM
I don't run windows and I don't develop on windows so win32 things is generally beyond me.

You're not the only one. Count me in, too... :)

Is it possible to simulate the hold button?

I trust you are wondering about this for WPS purposes? If so, put your image in the "else" condition for the test then switch it into the "if" condition when you're happy.

Is it possible to simulate plugging in the charger?

I trust you are wondering about this for WPS purposes? If so, put your image in the "else" condition for the test then switch it into the "if" condition when you're happy.

and finally how does it decide on the battery level and can I change it?

It seems to be always on battery level 3. Change it? Patch the simulator code.
Title: Re: UISimulator
Post by: Lear on September 17, 2005, 05:00:47 AM
The Win32 simulator is capable of playing sound (though the support isn't complete, it should be at the same level as the X11 simulator), but it won't build with that support by default; you have to edit autoconf.h first.

Still, as long as the codecs are properly installed, it should "play", and not be stuck at 0:00, but it can take a little while for it to start.
Title: Re: UISimulator
Post by: Mmmm on September 17, 2005, 05:15:22 AM
Lear : are you saying that i have to edit autoconf.h first or that it should play if I wait a bit?

Do you know what I have to change in autoconf.h?

Kenshin: Thanks, that answers my questions. I suppose if it wasn't for WPS purposes I'd have to patch the sim code to get these things working would I?
Title: Re: UISimulator
Post by: AlexP on September 17, 2005, 06:31:41 AM
If it doesn't play sound for you, then start figuring out why and fix it!

Things don't always fix themselves by magic you know.

I would if I could, believe me.  The extent of my programming skills are limited VB.  I was guessing that the playback capability wasn't there, not complaining it wasn't.

The Win32 simulator is capable of playing sound (though the support isn't complete, it should be at the same level as the X11 simulator), but it won't build with that support by default; you have to edit autoconf.h first.

That's interesting.  Given my non existant programming, I'll wait until someone else pokes around then hopefully tells me how to do it.  I certainly have the relevent codecs as sound (mp3/ogg etc) plays on my computer otherwise.
Title: Re: UISimulator
Post by: Lear on September 17, 2005, 07:36:05 AM
Lear : are you saying that i have to edit autoconf.h first or that it should play if I wait a bit?

It should play (i.e., not stay at 0:00) if you wait (not very long, a couple of seconds or so, IIRC). You need to edit autoconf.h to actually hear something.

Quote
Do you know what I have to change in autoconf.h?

#define ROCKBOX_HAS_SIMSOUND

It's there already though #undef:ed.
Title: Re: UISimulator
Post by: AlexP on September 17, 2005, 07:57:29 AM
It should play (i.e., not stay at 0:00) if you wait (not very long, a couple of seconds or so, IIRC). You need to edit autoconf.h to actually hear something.

Hmmm, bizarre - mine just stays at 0:00 for however long I leave it (forgetting about hearing anything at the moment).  It claims it is playing incidently, not paused.  If I hold down right to fast forward, it skips through as normal, but when I let go just sits there at the time I skipped to without moving.

I'm not particularly bothered, as I just wanted it to preview my WPS which it does fine.  Just a  bit odd, that's all!
Title: Re: UISimulator
Post by: Mmmm on September 17, 2005, 08:02:42 AM
Mine's the same as yours Bigbambi. It just sits at 0.00 for however long it is left ???

Quote
#define ROCKBOX_HAS_SIMSOUND

It's there already though #undef:ed.

Thanks Lear, I'll give that a go although I suppose I wont know if it works seeing as it doesn't actually play!

EDIT : ok, i've changed this line to #define but it still doesn't play... as suspected... anyone any ideas?

I've tried ogg, mp3, flac and wav all with the same result.
Title: Re: UISimulator
Post by: Mmmm on September 17, 2005, 04:34:17 PM
AHA.......I have it..... well, actually Lear had it all along but I was just being too dozy to really know what he was saying!  :-[ ::)

This is the Key

#define ROCKBOX_HAS_SIMSOUND

but you have to change this just before you compile..not after!!! its so obvious, of course it's source code, must be part of the makefile, you have to compile it or it won't do anything! I'm so stupid!

So after rbconf and creating the makefile, change this, then type make, make install and everything works beautifully. The lagging keys have even stopped lagging (I forgot to tell you that it seemed to be running very slow)!

;D ;D :D :) ;D :D :D...................... 8)
Title: Re: UISimulator
Post by: AlexP on September 18, 2005, 03:38:40 AM
Good stuff.  I'll give it a go forthwith
Title: Re: UISimulator
Post by: Mmmm on September 19, 2005, 06:54:15 AM
Is there some file i can change to include something like this so that #define ROCKBOX_HAS_SIMSOUND is the default setting for win32 simulator?

If simulator build and win32 is chosen,
create autoconf.h with

#define ROCKBOX_HAS_SIMSOUND

else
create autoconf.h with
#undef ROCKBOX_HAS_SIMSOUND

maybe something in the tools folder?
Title: Re: UISimulator
Post by: Bagder on September 19, 2005, 07:36:39 AM
autoconf.h is created by the tools/configure script

I don't know why the win32 simulator defaults to no sound. Anyone?
Title: Re: UISimulator
Post by: Lear on September 19, 2005, 09:15:10 AM
Mainly because I haven't updated the configure script I guess. :)
Title: Re: UISimulator
Post by: Mmmm on September 19, 2005, 11:33:39 AM
It' a shameless hack i know but putting these two lines into tools/configure does the trick!

Code: [Select]
79  if [ "$simver" = "win32" ]; then
80      # win32 version
81       GCCOPTS="$GCCOPTS -mno-cygwin -DNOCYGWIN"
82       LDOPTS="-lgdi32 -luser32 -mno-cygwin"
+ 83    use_simsound="#define ROCKBOX_HAS_SIMSOUND"
+ 84    echo "Enabled PCM sound playback in simulator"
85   else

I suppose there should really be a call to checksoundcard and then that should do the #define but it didn't seem to work, I assume this is because it doesn't do the checking properly on a windows system! Who knows?  :D
Title: Re: UISimulator
Post by: Mmmm on September 20, 2005, 12:40:02 PM
Ive made a guide to installing the simulator which i've put at the bottom of the simple guide to compiling.

Just click on the green part of my sig to see it.
Title: Re: UISimulator
Post by: g-funk on October 06, 2005, 11:27:42 AM
I just noticed that the UISim uses 99% of the CPU in windows.

At first I thought it might be cause I activated sound but now i compiled without sound and it still grabs the whole CPU even if i dont do anything and just let the UISim sit there.

Do any of you also have this problem?

Id like to fix it so if someone could help by pointing me in the right direction that would be great. Since I don't know my way around the RockBox firmware jet and ive not programmed in a long time.
Thanks :)


 
Title: Re: UISimulator
Post by: g-funk on October 06, 2005, 11:38:03 AM
I did some more testing and it looks like my CPU problem has to do with the Iriver Sim. Im using the H120/140 version.
Title: Re: UISimulator
Post by: AlexP on October 06, 2005, 01:19:34 PM
I'ver just had a look at it on my system in case it was a problem with g-funks only, but the iRiver H120/140 sim (the only one I've tried) sits at 99% CPU on mine too.

My system is an Athlon 2500+ with 1 GB of RAM, so clearly something is up!
Title: Re: UISimulator
Post by: hotwire on August 15, 2006, 09:33:18 PM
Is it possible to simulate the hold button?

Sorry to resuscitate a near dead thread, but I don't suppose we could map this to the to the Scroll Lock, and just use the Scroll Lock LED on our keyboards as a hold indicator?

Edit: Through some very preliminary reading about SDL from Google, looks like the Scroll Lock key in particular may not support this, though Caps Lock and Num Lock will.  Since for optimal use of some of the UISimulators (I'm personally more concerned with the gigabeat port), Num Lock should be on to allow use of the '5' key on the numpad, perhaps implement it where Hold is off when Num Lock is on.  I know it's a little backwards, but we're just aspiring and off/on indicator.
Title: Re: UISimulator
Post by: Llorean on August 16, 2006, 01:40:50 AM
Why not caps lock, exactly?
Title: Re: UISimulator
Post by: hotwire on August 16, 2006, 12:02:46 PM
After discussing it in the IRC channel, it was suggested that Sims that have a hold button should have a hold indicator on their wps.  I'm currently trying to implement it with Numpad7 and Numpad1 for DAP hold and remote hold, respectively, thereby also permitting it's use via the numpad since most of the Sim controls are through it.

Best reason why not to use caps lock, from personal experience is that I tend to multitask even when using the UISim, and if i turn caps lock on or off in another program, I can't easily predict the reaction to the UISim, and even if it is still okay, the point of the LED indicator becomes useless anyway.
Title: Re: UISimulator
Post by: Rincewind on August 16, 2006, 02:40:56 PM
Why not caps lock, exactly?

because some people (like me) change there caps lock key to be an additonal easy to reach ctrl-key.
Title: Re: UISimulator
Post by: hotwire on August 16, 2006, 09:05:21 PM
Well, it's working, save one glitch.  Since simulator hold status is set via a boolean variable, and not as a button in the regular sense of play, or menu, etc... it doesn't respond in one touch... it'll oscillate and you need to play with the key to get it to drop in or out of hold... at least I think that's the problem.

Hopefully somebody in the IRC channel can help me out on this and make it fit for prime time.
Title: Re: UISimulator
Post by: hotwire on August 17, 2006, 02:40:49 AM
So I scrapped the remote hold.  If really really necessary, almost verbatim code can be put in.

I was missing one line of code to make it work.  It runs now.  It'll be committed soon.
Title: Re: UISimulator
Post by: hotwire on August 17, 2006, 04:34:06 PM
So now I've been pulled into the fold, asked to add support for the LCD remotes to the UISim (since they are shown).  This likely won't be committed for a while though.

Remote hold works, but does anyone know a way to easily tell the difference of if a key input is from the remote or from the DAP?  From what i've been told, in practical use, the remote hold only holds the remote, and the dap hold only holds the dap.
Title: Re: UISimulator
Post by: Mmmm on August 18, 2006, 07:38:32 AM
(button_get(false) & BUTTON_REMOTE) is true if the key is from the remote.
Title: Re: UISimulator
Post by: hotwire on August 18, 2006, 07:30:58 PM
Thanks... encountered that in the IRC channel though already.

Next snag: what the iriver LCD remote buttons are assigned to (ie the 3 slider buttons are assigned to)