[ANN] Python for PSP

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
fraca7
Posts: 21
Joined: Mon Oct 03, 2005 12:55 am
Location: Paris
Contact:

[ANN] Python for PSP

Post by fraca7 »

is ready, and the PSP modules are somewhat usable. Downloads and documentation here:

http://fraca7.free.fr/pythonpsp/
flaxum
Posts: 4
Joined: Thu Oct 13, 2005 1:33 pm

Post by flaxum »

Thanks a lot!
This is absolutely amazing!
(No more mindless compiling to write a simple program!)
Radleb
Posts: 1
Joined: Mon Nov 14, 2005 9:54 am

Post by Radleb »

If u had ported Python Languaje to PSP could you do the same with PHP?
Since both are scripting languaje, and sometimes even share some sintaxis.
Could be posible to port PHP now?
Cya!

Radleb
User avatar
sherpya
Posts: 61
Joined: Mon Oct 03, 2005 5:49 pm

Post by sherpya »

php is not as good as python as standalone language, it's mainly used for web applications, an intresting stuff can be porting spidermonkey js engine, I've yet made a js shell with addons command for win32/unix, I may look for a psp port, I can re-use python psp module and convert it for use with js
stinkymeat
Posts: 10
Joined: Tue Oct 18, 2005 6:47 pm

Post by stinkymeat »

Woo! Yay! Good work!
benob
Posts: 1
Joined: Wed Nov 16, 2005 6:30 am

psp python idea

Post by benob »

why not porting pygame to python/psp. this lib is a frontend to sdl and is growing in popularity : there are more and more games created with it. (http://www.pygame.org)
fraca7
Posts: 21
Joined: Mon Oct 03, 2005 12:55 am
Location: Paris
Contact:

Post by fraca7 »

I've thought about porting pygame, but I wonder if it's not a bit heavy, compared to an ad hoc API... Maybe I'll give it a try anyway.
stinkymeat
Posts: 10
Joined: Tue Oct 18, 2005 6:47 pm

Post by stinkymeat »

According to psp2d module transform can be applied to images and pretty much anything (the way i understand it) what about screen. Is it like opengl where you move the scene, or do you move the screen or all the elements - docs say taht image transform is slow and screen uses hardware accl...
fraca7
Posts: 21
Joined: Mon Oct 03, 2005 12:55 am
Location: Paris
Contact:

Post by fraca7 »

Transformations are a half-assed attempt to generalize pixel-based effects on an image, or the screen. Since they operate pixel by pixel and each pixel may be affected arbitrarily through a user-defined callback, there is no way it can be hardware accelerated. It's only intended to pre-calculate some sophisticated visual effects.

As a matter of fact, I don't even know if this class will make it in the final release, I'm not sure it's actually of any use in practice :)

I'll update the wiki tomorrow with detailed information and examples of the stuff that is not covered int the tutorial, including tranformations.
stinkymeat
Posts: 10
Joined: Tue Oct 18, 2005 6:47 pm

Post by stinkymeat »

Good stuff, nice to see that you are committed to a project :D
rinco
Posts: 255
Joined: Fri Jan 21, 2005 2:12 pm
Location: Canberra, Australia

Post by rinco »

Any hints on how to build Python? I put together this command line but I just get errors:
CXX=psp-g++ LDFLAGS="-L`psp-config --pspsdk-path`/lib -lstdc++ -lpsplibc -lpspkernel -lpspuser" ./configure --host=psp --prefix=`psp-config --psp-prefix`
...
psp-gcc -c -Wno-long-double -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -o Modules/python.o Modules/python.c
psp-gcc: unrecognized option '-no-cpp-precomp'
cc1: error: unrecognized command line option "-Wno-long-double"
make: *** [Modules/python.o] Error 1
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

mstrhelix
Posts: 7
Joined: Fri Feb 10, 2006 10:43 am

Post by mstrhelix »

Ok i just recently d-loaded the python interpreter for PSP and i want to contribute to the scene but I cannot seem to find anywhere a PSP2D module that is for PSP. I cannot compile one but would like to develope in Python. can anyone please post a link or tell me where to get it. I went to the PSP Python wiki and looked all over with no luck for d-load anything but source code.
Elric
Posts: 2
Joined: Fri Feb 16, 2007 4:55 am

Post by Elric »

I know that the psp-python site is down temporarily for construction, but has anyone mirrored the old site or made files available for doing development in the interim while the "official" site is down?

I'd like to try some PSP development and python would be my preferred language. Based on googling and searching here, it seems like the port was pretty stable/usable before the site went down.

Thanks for any info/ideas!! :)
Jai_Guru
Posts: 12
Joined: Sun Aug 13, 2006 8:01 am

Post by Jai_Guru »

Can VPython be used with this?
http://www.vpython.org/
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

Elric wrote:I know that the psp-python site is down temporarily for construction, but has anyone mirrored the old site or made files available for doing development in the interim while the "official" site is down?

I'd like to try some PSP development and python would be my preferred language. Based on googling and searching here, it seems like the port was pretty stable/usable before the site went down.

Thanks for any info/ideas!! :)
Well, I'm glad I got the stuff when I did (Jan 11, 2007). Hopefully it isn't down long.

I play the solitaire game that was on that site quite often. It's definately stable.
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

Hi!
J.F. wrote:I play the solitaire game that was on that site quite often. It's definately stable.
The last release fixed a memory leak in fonts, but broke drawing fonts over images....but it's stable. :)

Ciaooo
Sakya
Elric
Posts: 2
Joined: Fri Feb 16, 2007 4:55 am

Post by Elric »

sakya wrote:Hi!
J.F. wrote:I play the solitaire game that was on that site quite often. It's definately stable.
The last release fixed a memory leak in fonts, but broke drawing fonts over images....but it's stable. :)

Ciaooo
Sakya
Anyone have a pointer to a spot where the last stable build can be downloaded while the main site is down? Thanks!
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

Hi!
Elric wrote:Anyone have a pointer to a spot where the last stable build can be downloaded while the main site is down? Thanks!
You can download from here the latest eboot with a test script that shows the font bug. :)
It's not the "original" release...I've only converted it for FW 1.50 and added the icon.

http://www.MegaShare.com/112221

Ciaooo
Sakya
fraca7
Posts: 21
Joined: Mon Oct 03, 2005 12:55 am
Location: Paris
Contact:

Post by fraca7 »

I just fixed the font drawing bug. Binary release at the usual place:

http://fraca7.free.fr/EBOOT.PBP
fraca7
Posts: 21
Joined: Mon Oct 03, 2005 12:55 am
Location: Paris
Contact:

Post by fraca7 »

I just fixed the font drawing bug. Binary release at the usual place:

http://fraca7.free.fr/EBOOT.PBP
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

Hi! :)
fraca7 wrote:I just fixed the font drawing bug. Binary release at the usual place:
Wow, many thanks! :)

Downloading now.

Ciaooo
Sakya
sakya
Posts: 190
Joined: Fri Apr 28, 2006 5:48 pm
Contact:

Post by sakya »

Hi!

I think I found some bugs in this release.
Check this script:

Code: Select all

import thread
import psp2d
import pspnet
from time import time, sleep
from pspos import freemem, getclock, setclock, getbus, setbus, battery 

msg = ""
clock = getclock()

def newThread(pNumber):
  global msg
  msg = "Started thread " + str(pNumber)
  sleep(2)
  msg = "Finished thread " + str(pNumber)


def connectionCB(state):
  global msg
  msg = "STATE: " + str(state)


#Main:
screen = psp2d.Screen()
font = psp2d.Font('font.png')
background_image = psp2d.Image(480,272)
background_image.clear(psp2d.Color(0,0,0))
oldPad = None
number = 0
padTime = None

while True:
  screen.blit(background_image, 0, 0, background_image.width, background_image.height, 0, 0)
  font.drawText(screen, 20, 120, "CLOCK SET TO: " + str(clock))
  font.drawText(screen, 20, 140, "TIME: " + str(time()))
  font.drawText(screen, 20, 160, "MESSAGE: " + msg)
  newText = "MEM: " + str(freemem() / 1024) + "kb  CPU:" + str(getclock()) + "Mhz  BUS:" + str(getbus()) + "Mhz  BATT:" + str(battery()[3]) + "%"
  font.drawText(screen, 0, 0, newText)
  screen.swap()

  pad = psp2d.Controller()
  if pad != oldPad \
  and not padTime or time() - padTime >= 0.2:
    padTime = time()
    if pad.cross:
      number += 1
      thread.start_new_thread(newThread, (number,))
    elif pad.circle:
      msg = "Connecting"
      pspnet.connectToAPCTL(2, connectionCB)
    elif pad.r and clock < 333&#58;
      clock += 1
      setclock&#40;clock&#41;
    elif pad.l and clock > 0&#58;
      clock -= 1
      setclock&#40;clock&#41;
    oldPad = pad
1.When you start a new thread (press X) the main thread hangs waiting for the child thread to finish.
2.Sometimes when the script starts the video is corrupted. Launching the application with the wifi switch on seems to fix this problem. Avoiding to import pspnet seems to fix this problem. I think it's the function to check the wlan switch. I had the same problem trying to add this function on my own.

Many thanks for your work.

Ciaooo
Sakya
Post Reply