Python27 interpreter and shell

Discussion in '3DS - Homebrew Development and Emulators' started by MarcusD, Aug 11, 2016.

  1. MarcusD
    OP

    MarcusD baby Near

    Member
    1,221
    2,559
    Oct 16, 2015
    Hungary
    under the bed
    As some people may know, someone on Reddit managed to include the Python interpreter in a 3DS homebrew game. Before dumping to .cia was a thing, I wanted to make @ihaveamac's 3dsconv.py work on the 3DS, so I made a Makefile to compile the Python interpreter with the most modules as possible, and it turned out to work, and I converted my OoT cartridge dump (~460M) in 25minutes into a cia :D (blame 3DS IO "speed")

    Video
    Developer pics

    This could be the Python version of lpp-3DS, but I'm too lazy to write the wrappers myself, because Python already supports most stuff out-of-the-box :P

    Differences between the interpreter and the shell:
    • The interpreter runs init.py on start, while the shell is the command-line interpreter made to work on the 3DS (the video showcases that)
    • The interpreter goes into debug mode if init.py crashes, otherwise it exits after init.py is done
    Included stock modules
    Included custom modules
    Note: these downloads below are just techdemos! Some stuff (especially sockets) may be broken:P
    3dsx | cia | soos | Makefile
     
    Last edited by MarcusD, Aug 16, 2016
    VegaRoXas, Teun1, smealum and 22 others like this.
  2. raulpica

    raulpica With your drill, thrust to the sky!

    Supervisor
    11,041
    7,360
    Oct 23, 2007
    Italy
    PowerLevel: 9001
    Man, I love Python. Godspeed.
     
  3. Megalegacy98

    Megalegacy98 ( ͡° ͜ʖ ͡°)™

    Member
    505
    259
    Aug 11, 2015
    United States
    Just around the corner™
    I use Python in almost all of my projects and would love to see my scripts on 3DS :D Thank you so much for this!
     
    astronautlevel and MarcusD like this.
  4. astronautlevel

    astronautlevel Finding a reason, waiting for a miracle

    Member
    4,044
    5,090
    Jan 26, 2016
    United States
    That Nightly Site™
    Looking pretty good, nice work!
     
    gnmmarechal, ihaveamac and MarcusD like this.
  5. indionicarao

    indionicarao Member

    Newcomer
    13
    1
    Mar 19, 2015
    United States
    Portland, Oregon
    Oh snap, excited to play around on this once it's released.
     
  6. cots

    cots GBAtemp Advanced Fan

    Member
    511
    330
    Dec 29, 2014
    United States
    This is exciting.
     
    ihaveamac likes this.
  7. B_E_P_I_S_M_A_N

    B_E_P_I_S_M_A_N I have graced this thread with my presence.

    Member
    852
    3,214
    Jun 7, 2016
    United States
    Hell
    This should speed up quite a few aspects of homebrew development. Good job!

    Now we can get the Pythonites in on the whole homebrew development thing.
     
    Megalegacy98 and astronautlevel like this.
  8. SimplyFedorable

    SimplyFedorable Evangelion Geek

    Member
    568
    231
    Apr 7, 2016
    United States
    melee hell
    welp, now I don't have to learn c to develop homebrew
     
  9. JerwuQu

    JerwuQu Advanced Member

    Newcomer
    56
    66
    Feb 15, 2015
    Why not Python35 instead? ;0
     
  10. MarcusD
    OP

    MarcusD baby Near

    Member
    1,221
    2,559
    Oct 16, 2015
    Hungary
    under the bed
    Python3 should be working, but it needs additional patches, and since recompiling after an error takes ~20-40minutes, I got bored of it. I'll do it eventually :P
     
    geekqueen2010 and I pwned U! like this.
  11. JerwuQu

    JerwuQu Advanced Member

    Newcomer
    56
    66
    Feb 15, 2015
    I was just thinking that having multiple Pythons interpreters would split the community and using the latest one would be better for the future :>
     
  12. MarcusD
    OP

    MarcusD baby Near

    Member
    1,221
    2,559
    Oct 16, 2015
    Hungary
    under the bed
    Nah... Since init.py is compiled into the 3dsx, there would be no problem with version differences :P The best I could do, is to install the Python interpreter as a separate app, and I would write a wrapper that calls the interpreter, this way you don't need to waste 10megs for every Python application :P
     
  13. ksanislo

    ksanislo GBAtemp Fan

    Member
    378
    218
    Feb 23, 2016
    United States
    Seattle, WA
    Mind if I ask how you're compiling this that takes ~20-40 minutes? A compile of Python 3.5 on an Intel Atom C2750 based machine takes ~5 minutes for me... I'd imagine on a chip that's not intended for super low power usage, it should be even faster...
     
    Last edited by ksanislo, Aug 12, 2016
  14. MarcusD
    OP

    MarcusD baby Near

    Member
    1,221
    2,559
    Oct 16, 2015
    Hungary
    under the bed
    Intel Celeron on win8 (not 8.1) takes ~20-40mins... On Linux-x86_64 it takes ~15-25mins to build.
     
    Wolfvak likes this.
  15. ksanislo

    ksanislo GBAtemp Fan

    Member
    378
    218
    Feb 23, 2016
    United States
    Seattle, WA
    Are you building in parallel or just a single thread at a time?
     
    Last edited by ksanislo, Aug 12, 2016
  16. MarcusD
    OP

    MarcusD baby Near

    Member
    1,221
    2,559
    Oct 16, 2015
    Hungary
    under the bed
    u wot? How could I build on multiple cores? It's nearly killing the lappy already at almost 100% CPU usage :cry:
     
  17. DKB

    DKB N I G H T M A R E

    Member
    GBAtemp Patron
    DKB is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    1,294
    1,251
    May 29, 2015
    United States
    New York City, Manhattan
    Damn, maybe it's finally time for me to break out that Python book I have and start learning it. lol
     
  18. ksanislo

    ksanislo GBAtemp Fan

    Member
    378
    218
    Feb 23, 2016
    United States
    Seattle, WA
    If you're using make, just add -j<threadcount> ... General rule of thumb is that you should use ~2x the number of cores for good IO utilization.
     
    Last edited by ksanislo, Aug 13, 2016
    Megalegacy98 and ihaveamac like this.
  19. MarcusD
    OP

    MarcusD baby Near

    Member
    1,221
    2,559
    Oct 16, 2015
    Hungary
    under the bed
    YAY! I got networking working :D

    Big image

    I'll upload the 3dsx and cia in a few minutes ;)
     
  20. astronautlevel

    astronautlevel Finding a reason, waiting for a miracle

    Member
    4,044
    5,090
    Jan 26, 2016
    United States
    That Nightly Site™
    And source code, I assume? :P