forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[Help/Suggestions needed] MultiTasKing v101

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Thu Dec 10, 2009 4:14 am    Post subject: [Help/Suggestions needed] MultiTasKing v101 Reply with quote

Hi guys!
I came here a few months ago under the username "usertestprueba" (xD) and thanks to your help I have managed to get this:

http://www.youtube.com/watch?v=jDLfzjE--qg

I just want to know what do you think about it :-)
Please, suggest things, and checkout the prx sources ;-)

Thank you very much for your help.

Cheers,
Carlosgs


Last edited by carl0sgs on Sat Feb 06, 2010 1:21 am; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
anmabagima



Joined: 01 Oct 2009
Posts: 96

PostPosted: Thu Dec 10, 2009 5:29 am    Post subject: Wow Reply with quote

Hi,

this really looks amazing. You are starting porting Windows onto PSP ?
Good stuff. I hav't seen the source...the result looks nice ;o)
Back to top
View user's profile Send private message
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Thu Dec 10, 2009 6:58 am    Post subject: Re: Wow Reply with quote

anmabagima wrote:
Hi,

this really looks amazing. You are starting porting Windows onto PSP ?
Good stuff. I hav't seen the source...the result looks nice ;o)


It is not windows, it is my own window manager :-)
Thanks for the support ;-)
Back to top
View user's profile Send private message Visit poster's website
m0skit0



Joined: 02 Jun 2009
Posts: 226

PostPosted: Thu Dec 10, 2009 10:45 am    Post subject: Reply with quote

Nice job :)
_________________
The Incredible Bill Gates wrote:
The obvious mathematical breakthrough would be development of an easy way to factor large prime numbers.
Back to top
View user's profile Send private message
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Fri Dec 11, 2009 12:36 am    Post subject: Reply with quote

m0skit0 wrote:
Nice job :)


Thanks! :-D
Back to top
View user's profile Send private message Visit poster's website
liberty



Joined: 16 Sep 2009
Posts: 35

PostPosted: Sat Dec 12, 2009 7:46 am    Post subject: Re: MultiTasKing v101 Reply with quote

carl0sgs wrote:
Hi guys!
I came here a few months ago under the username "usertestprueba" (xD) and thanks to your help I have managed to get this:

http://www.youtube.com/watch?v=jDLfzjE--qg

I just want to know what do you think about it :-)
Please, suggest things, and checkout the prx sources ;-)

Thank you very much for your help.

Cheers,
Carlosgs


Really good. A wonder window manager. How about some widget tools?
Back to top
View user's profile Send private message
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Sat Dec 12, 2009 8:55 am    Post subject: Re: MultiTasKing v101 Reply with quote

liberty wrote:
Really good. A wonder window manager. How about some widget tools?


Thanks! :-)
What do you mean with widget tools?
Back to top
View user's profile Send private message Visit poster's website
Raphael



Joined: 17 Jan 2006
Posts: 646
Location: Germany

PostPosted: Sat Dec 12, 2009 9:32 am    Post subject: Reply with quote

A library that provides a list of GUI elements (sometimes called 'widgets'), like buttons, checkboxes, textboxes, menus, etc.
_________________
<Don't push the river, it flows.>
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki

Alexander Berl
Back to top
View user's profile Send private message Visit poster's website
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Sat Dec 12, 2009 9:51 am    Post subject: Reply with quote

Oh ok then xD

I've thought about that, but still don't have a clear idea of how to make it :-S
By now it is possible to use the common graphics.h printing functions in the windows (enough for simple programs).

If you have any idea on how to make that, it would be really useful :-P
Thanks!
Back to top
View user's profile Send private message Visit poster's website
ne0h



Joined: 21 Feb 2008
Posts: 386

PostPosted: Tue Dec 15, 2009 6:17 am    Post subject: Reply with quote

--- nevermind ---
_________________
Get Xplora!
Back to top
View user's profile Send private message
Ameen



Joined: 14 Jun 2009
Posts: 12
Location: Bahrain

PostPosted: Sun Jan 03, 2010 10:31 am    Post subject: Reply with quote

Wow, if you would add more to it, I pretty much believe you can end up with some decent project for the PSP community.

You rock!
Cheers,
Back to top
View user's profile Send private message Visit poster's website
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Thu Feb 04, 2010 3:11 am    Post subject: Reply with quote

Hi again!
So I've been thinking about how to implement widgets ;-)

I have the idea, (i've added simple buttons support) and now I just need some speed.

Here is a screenshot:



(The buttons keep count of the times they've been pressed)

I need your help and suggestions:
I want to use OSLib, because it uses the GU (graphics.h is too slow) and it is possible to use intrafont in a fast way, rotate images...

So, my idea is to have in each window a list (doubily linked) with each image, each button... etc, each element of the API.
In the background I'd add just a color.

Then, when refreshing the screen, the program would go through the windows list, and in each window it'd look into the API list, and print all the stuff.

Oh, and the main thing is to use "sceGUscissor" to set the drawing area in each window, limiting everything correctly ;-)

The problem comes when I want to print something into an image, cause OSLib requires the GU (graphics.h uses software only for this, that's why it is slow here).

I have not much experience with OSLib, so some help would be really appreciated.

Thanks a lot :-)
Back to top
View user's profile Send private message Visit poster's website
sauron_le_noir



Joined: 05 Jul 2008
Posts: 229

PostPosted: Thu Feb 04, 2010 7:18 am    Post subject: Reply with quote

Don't mix gu and mod_osl, do all the stuff with mod_osl
a sample menu choice with image + text
if you use c++ you can do a class per object earch object has a render method
all the object you created are put in a linked list for earch event you put the messageto the object that have subscibe to receive the event. Each object is responsible to
render is image. Look at the code of a old homebrew fileassistant it is what you want
to do and it use gu and not osl ;)

Code:

while (!osl_quit)
  {
 //Doit on faire le rendu?

    if (!skip)   
      {
         oslStartDrawing();
         oslDrawImageXY(img, 0 ,0);
         oslSetTransparentColor( couleurMasque );
         if (num_tableau == 0)
              oslDrawImageXY(imgchoix[num_tableau], 90 ,25);
         else oslDrawImageXY(imgchoix[num_tableau], 90 ,40);
         oslSetBkColor(RGBA(0,0,0,0));

    oslSetTextColor(RGB(0, 128, 0));

    oslPrintf_xy(180, 13, titre[num_tableau]);
         if (tempo == 15)
            {
               tempo=0;
               sav = textinfo[0];
              for(i=0;i<strlen(textinfo)-1;i++)
                textinfo[i] = textinfo[i+1];
              textinfo[i] = sav;
            }
         else tempo++;
         strcpy(text,textinfo);
         text[60] = '\0';
         

         oslSetTextColor(RGB(255,0,0));
         oslPrintf_xy(20, 250, text);
         
         oslEndFrame();

    oslEndDrawing();
      }
    //Pour pouvoir gérer les touches

    oslReadKeys();

    if (osl_pad.pressed.cross)
      return num_tableau;

   if (osl_pad.pressed.circle)
     {
       num_tableau++;
       if (num_tableau == 3)
           num_tableau = 0;
     }

   //Synchro à 60 fps

    skip = oslSyncFrameEx(0, 6, 0);
  }
  return -1;
}
Back to top
View user's profile Send private message Send e-mail MSN Messenger
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Fri Feb 05, 2010 2:22 am    Post subject: Reply with quote

thanks for the source!

but i think i haven't explained myself correctly
the problem is that the sceGU is needed in different threads, and when it is started in one thread you cannot use it from other threads.
This is solved by making objects lists wich are printed all at a time in the screen.

But! what if I need to manipulate images from other threads? shall I add something like a semaphore to avoid starting the GU from different threads?

Any idea?

Thank you for your help!
Back to top
View user's profile Send private message Visit poster's website
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Sat Feb 06, 2010 7:35 pm    Post subject: Reply with quote

I think i'm going to make a semaphore, so you can "lock" the GU if it is been used.
Something like "MTimageGuStart" and "MTimageGuEnd" before and after using image functions.
Back to top
View user's profile Send private message Visit poster's website
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Sun Feb 07, 2010 8:36 am    Post subject: Reply with quote

You probably want to split your code up better. Sounds right now like the drawing and updating and input are all mixed together. It would be better if you had a data structure for your windows - for simplicity's sake let's say it was just a linked list of id,x,y,width,height of each window.
Then you have a semaphore which locks access to the list. Any thread wanting to modify a window locks the list, makes the change, and unlocks it again.
You also have a single thread which knows how to draw windows. It also locks the list, draws all the windows in one go, then unlocks the list.
That way you have divided responsibility for update and drawing into separate places and solved the problem of multithreaded gu access.

If the 'big lock' on the list is too 'lumpy' you can work on having a semaphore for each window and a drawing semaphore. Updating a window locks both its own semaphore and the drawing one.

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Sun Feb 07, 2010 9:48 am    Post subject: Reply with quote

Thanks! Great idea :-P

Right now the windows are structures, so thats not a problem xD

For drawing in the windows I have thought about making "drawing" and "reading" buffers,
two lists with the window's content. (One of them would be printed out in the main "printing" thread, the other one used for drawing things into the window and then, swapping the buffers).

I'm going to learn and practise with semaphores, cause I have no idea right now.
(I've been using variables like "printingWindows = 1" and while(printingWindows == 1) delay(1000); as a kind of semaphore lol)

Thanks again,
Carlos
Back to top
View user's profile Send private message Visit poster's website
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Sun Feb 07, 2010 11:01 am    Post subject: Reply with quote

Quote:
For drawing in the windows I have thought about making "drawing" and "reading" buffers,

Right, double buffering is another excellent way of reducing the amount of locking.
There are proper sce calls for semaphores in the pspsdk, or else there's a port of pthreads for PSP in svn.

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Tue Feb 16, 2010 12:43 am    Post subject: Reply with quote

Ok I'll take a look when I have time.

Thanks again!
Back to top
View user's profile Send private message Visit poster's website
n0w



Joined: 16 Feb 2010
Posts: 4
Location: Spain

PostPosted: Wed Feb 17, 2010 7:28 am    Post subject: Reply with quote

Simply amazing! Are you planning to release sources?
_________________
"The only people who never fail are those who never try."

http://www.n0w-dev.net/
Back to top
View user's profile Send private message Visit poster's website
carl0sgs



Joined: 10 Dec 2009
Posts: 41

PostPosted: Wed Feb 17, 2010 8:12 am    Post subject: Reply with quote

Yes, actually I would like to make an opensource project about this, but for that I need first to have something stable, the "main structure".

It would be really awesome to have even 3D drawing capabilities in the windows, maybe I'm pointing too high with this ><

I'm thinking a lot about how to make this (well. Right now it is just "usable", i want more ;-)).

I will have time for this in Summer, anyway.

Cheers,
Carlosgs
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group