Migration from scratch de la version 2.10 NIHM
16
BIN/CPS3.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/CPS3/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/CPS3.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
622
BIN/ConfigKeyboard.py
Executable file
@ -0,0 +1,622 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding: utf-8 -*-
|
||||
|
||||
import os, sys, pygame, pygame.font, pygame.image,subprocess, sys, time
|
||||
from pygame.locals import *
|
||||
sys.path.insert(0, '../CONF/')
|
||||
import urllib2
|
||||
import math
|
||||
from DefResAndSysFile import *
|
||||
Resolution=DefResolution()
|
||||
|
||||
def getSize(filename):
|
||||
st = os.stat(filename)
|
||||
return st.st_size
|
||||
|
||||
|
||||
pygame.init()
|
||||
|
||||
finished = 0
|
||||
|
||||
|
||||
### PROD
|
||||
pygame.init()
|
||||
Y,X=Resolution
|
||||
PyrScreen = pygame.display.set_mode(Resolution,FULLSCREEN)
|
||||
|
||||
ConfigFile="../CONF/KeyMapKeyBoard.py"
|
||||
KeyHack = 'NULL'
|
||||
T1=0
|
||||
TDiff=0
|
||||
Space_bar=20
|
||||
XBAR=(Y-(Y/Space_bar))
|
||||
YBAR=(X/10)
|
||||
WHERE_XBAR=Space_bar
|
||||
WHERE_YBAR=(Y/2) - (YBAR/2)
|
||||
|
||||
|
||||
fond = pygame.transform.scale(pygame.image.load("KEY/background_key.png").convert(),Resolution)
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
time.sleep(0.8)
|
||||
SCREEN_W,SCREEN_H = Resolution
|
||||
FontSize=(SCREEN_H/10)
|
||||
print "FontSize => " + str(FontSize)
|
||||
font = pygame.font.Font('../MEDIA/font.ttf', FontSize)
|
||||
|
||||
|
||||
|
||||
resolution=SCREEN_W,SCREEN_H
|
||||
|
||||
SIZE_IMG_BTN=int(SCREEN_H/3)
|
||||
|
||||
WHERE_IMG_X = int(SCREEN_W /2) - int(SIZE_IMG_BTN/2)
|
||||
WHERE_IMG_Y = int(SCREEN_H /2) - int(SIZE_IMG_BTN/2)
|
||||
WHERE_IMG = (WHERE_IMG_X,WHERE_IMG_Y)
|
||||
WHERE_TEXTE_X = int(SCREEN_W /6)
|
||||
WHERE_TEXTE_Y = int(SCREEN_H /6)
|
||||
WHERE_TEXTE=(WHERE_TEXTE_X,WHERE_TEXTE_Y)
|
||||
WHERE_TEXTE_HACK=(10,10)
|
||||
|
||||
pygame.joystick.init()
|
||||
while KeyHack == 'NULL':
|
||||
text1 = "Do you used a hack keyboard card ? (UP : Yes / DOWN : No)"
|
||||
text2 = font.render(text1, True, pygame.Color("black"), pygame.Color("red"))
|
||||
TDiff=5-(round(time.time() - T1))
|
||||
# PyrScreen.blit(fond, (0,0))
|
||||
pygame.display.update()
|
||||
# PyrScreen.blit(text2,(Space_bar,WHERE_YBAR+(YBAR*2)))
|
||||
PyrScreen.blit(text2,(WHERE_TEXTE_HACK))
|
||||
PngKeyPush="KEY/BTN_HACK.png"
|
||||
PngKeyPushObj=pygame.transform.scale(pygame.image.load(PngKeyPush).convert_alpha(),(SIZE_IMG_BTN,SIZE_IMG_BTN))
|
||||
PyrScreen.blit(PngKeyPushObj,WHERE_IMG),(SIZE_IMG_BTN,SIZE_IMG_BTN)
|
||||
|
||||
|
||||
for event in pygame.event.get():
|
||||
|
||||
if event.type == KEYDOWN and event.key == K_UP:
|
||||
KeyHack='Y'
|
||||
|
||||
if event.type == KEYDOWN and event.key == K_DOWN:
|
||||
KeyHack='N'
|
||||
|
||||
|
||||
if pygame.joystick.get_count() != 0:
|
||||
print "Y a un joystick"
|
||||
|
||||
if pygame.joystick.get_count() != 0 and KeyHack == 'N':
|
||||
print "You select no HackKeyboard or joy = " + KeyHack
|
||||
mon_joystick = pygame.joystick.Joystick(0)
|
||||
mon_joystick.init()
|
||||
|
||||
ListeCommandToSet=['BTN_J1_1','BTN_J1_2','BTN_J1_3','BTN_J1_4','BTN_J1_5','BTN_J1_6','SELECT_J1','COIN_J1','START_J1','BTN_J2_1','BTN_J2_2','BTN_J2_3','BTN_J2_4','BTN_J2_5','BTN_J2_6','SELECT_J2','COIN_J2','START_J2']
|
||||
JOY_TEST = 1
|
||||
else:
|
||||
print "You select a HackKeyboard or keyboard = " + KeyHack
|
||||
JOY_TEST = 0
|
||||
ListeCommandToSet=['UP_J1','DOWN_J1','LEFT_J1','RIGHT_J1','BTN_J1_1','BTN_J1_2','BTN_J1_3','BTN_J1_4','BTN_J1_5','BTN_J1_6','SELECT_J1','COIN_J1','START_J1','UP_J2','DOWN_J2','LEFT_J2','RIGHT_J2','BTN_J2_1','BTN_J2_2','BTN_J2_3','BTN_J2_4','BTN_J2_5','BTN_J2_6','SELECT_J2','COIN_J2','START_J2']
|
||||
|
||||
if not os.path.exists(ConfigFile):
|
||||
file = open(ConfigFile, "w")
|
||||
file.write("import pygame\n")
|
||||
file.write("from pygame.locals import *\n\n")
|
||||
if KeyHack == 'Y':
|
||||
file.write("HACK_KEY_CARD = 'Y'\n\n")
|
||||
if KeyHack == 'N':
|
||||
file.write("HACK_KEY_CARD = 'N'\n\n")
|
||||
|
||||
|
||||
|
||||
#else:
|
||||
# os.remove(ConfigFile)
|
||||
# file = open(ConfigFile, "w")
|
||||
# file.write("import pygame\n")
|
||||
# file.write("from pygame.locals import *\n\n")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
continuer = 1
|
||||
KeyToExport="NULL"
|
||||
|
||||
for KeyPush in ListeCommandToSet:
|
||||
print KeyPush
|
||||
text1 = "Push a key for : " + KeyPush + "(" + str(TDiff) + ")"
|
||||
text2 = font.render(text1, True, pygame.Color("black"), pygame.Color("white"))
|
||||
#PyrScreen.blit(fond, (0,0))
|
||||
PyrScreen.blit(text2,(WHERE_TEXTE))
|
||||
|
||||
PngKeyPush="KEY/" + KeyPush + ".png"
|
||||
PngKeyPushObj=pygame.transform.scale(pygame.image.load(PngKeyPush).convert_alpha(),(SIZE_IMG_BTN,SIZE_IMG_BTN))
|
||||
PyrScreen.blit(PngKeyPushObj,WHERE_IMG),(SIZE_IMG_BTN,SIZE_IMG_BTN)
|
||||
|
||||
# PyrScreen.blit(PngKeyPushObj)
|
||||
|
||||
# pygame.display.update()
|
||||
|
||||
|
||||
print "Push a key for : " + KeyPush
|
||||
|
||||
if T1 == 0:
|
||||
T1=time.time()
|
||||
|
||||
while KeyToExport == "NULL":
|
||||
text1 = "Push a key for : " + KeyPush + "(" + str(TDiff) + ")"
|
||||
text2 = font.render(text1, True, pygame.Color("black"), pygame.Color("white"))
|
||||
TDiff=5-(round(time.time() - T1))
|
||||
# PyrScreen.blit(fond, (0,0))
|
||||
pygame.display.update()
|
||||
# PyrScreen.blit(text2,(Space_bar,WHERE_YBAR+(YBAR*2)))
|
||||
PyrScreen.blit(text2,(WHERE_TEXTE))
|
||||
|
||||
|
||||
for event in pygame.event.get():
|
||||
|
||||
if JOY_TEST != 0 and event.type == JOYBUTTONDOWN:
|
||||
T1 = 0
|
||||
if event.button == 1:
|
||||
print 'Btn 1 -> ' + str(event.button)
|
||||
KeyToExport="1"
|
||||
if event.button == 2:
|
||||
print 'Btn 2 -> ' + str(event.button)
|
||||
KeyToExport="2"
|
||||
if event.button == 3:
|
||||
print 'Btn 3 -> ' + str(event.button)
|
||||
KeyToExport="3"
|
||||
if event.button == 4:
|
||||
print 'Btn 4 -> ' + str(event.button)
|
||||
KeyToExport="4"
|
||||
if event.button == 5:
|
||||
print 'Btn 5 -> ' + str(event.button)
|
||||
KeyToExport="5"
|
||||
if event.button == 6:
|
||||
print 'Btn 6 -> ' + str(event.button)
|
||||
KeyToExport="6"
|
||||
if event.button == 7:
|
||||
print 'Btn 7 -> ' + str(event.button)
|
||||
KeyToExport="7"
|
||||
if event.button == 8:
|
||||
print 'Btn 8 -> ' + str(event.button)
|
||||
KeyToExport="8"
|
||||
if event.button == 9:
|
||||
print 'Btn 9 -> ' + str(event.button)
|
||||
KeyToExport="9"
|
||||
|
||||
|
||||
if JOY_TEST == 0 :
|
||||
|
||||
if event.type == KEYDOWN:
|
||||
T1 = 0
|
||||
if event.key == K_BACKSPACE:
|
||||
print "backspace -> " + str(event.key)
|
||||
KeyToExport="K_BACKSPACE"
|
||||
if event.key == K_TAB:
|
||||
print "tab -> " + str(event.key)
|
||||
KeyToExport="K_TAB"
|
||||
if event.key == K_CLEAR:
|
||||
print "clear -> " + str(event.key)
|
||||
KeyToExport="K_CLEAR"
|
||||
if event.key == K_RETURN:
|
||||
print "return -> " + str(event.key)
|
||||
KeyToExport="K_RETURN"
|
||||
if event.key == K_PAUSE:
|
||||
print "pause -> " + str(event.key)
|
||||
KeyToExport="K_PAUSE"
|
||||
if event.key == K_ESCAPE:
|
||||
print "escape -> " + str(event.key)
|
||||
KeyToExport="K_ESCAPE"
|
||||
if event.key == K_SPACE:
|
||||
print "space -> " + str(event.key)
|
||||
KeyToExport="K_SPACE"
|
||||
if event.key == K_EXCLAIM:
|
||||
print "exclaim -> " + str(event.key)
|
||||
KeyToExport="K_EXCLAIM"
|
||||
if event.key == K_QUOTEDBL:
|
||||
print "quotedbl -> " + str(event.key)
|
||||
KeyToExport="K_QUOTEDBL"
|
||||
if event.key == K_HASH:
|
||||
print "hash -> " + str(event.key)
|
||||
KeyToExport="K_HASH"
|
||||
if event.key == K_DOLLAR:
|
||||
print "dollar -> " + str(event.key)
|
||||
KeyToExport="K_DOLLAR"
|
||||
if event.key == K_AMPERSAND:
|
||||
print "ampersand -> " + str(event.key)
|
||||
KeyToExport="K_AMPERSAND"
|
||||
if event.key == K_QUOTE:
|
||||
print "quote -> " + str(event.key)
|
||||
KeyToExport="K_QUOTE"
|
||||
if event.key == K_LEFTPAREN:
|
||||
print "leftparen -> " + str(event.key)
|
||||
KeyToExport="K_LEFTPAREN"
|
||||
if event.key == K_RIGHTPAREN:
|
||||
print "rightparen -> " + str(event.key)
|
||||
KeyToExport="K_RIGHTPAREN"
|
||||
if event.key == K_ASTERISK:
|
||||
print "asterisk -> " + str(event.key)
|
||||
KeyToExport="K_ASTERISK"
|
||||
if event.key == K_PLUS:
|
||||
print "plus -> " + str(event.key)
|
||||
KeyToExport="K_PLUS"
|
||||
if event.key == K_COMMA:
|
||||
print "comma -> " + str(event.key)
|
||||
KeyToExport="K_COMMA"
|
||||
if event.key == K_MINUS:
|
||||
print "minus -> " + str(event.key)
|
||||
KeyToExport="K_MINUS"
|
||||
if event.key == K_PERIOD:
|
||||
print "period -> " + str(event.key)
|
||||
KeyToExport="K_PERIOD"
|
||||
if event.key == K_SLASH:
|
||||
print "slash -> " + str(event.key)
|
||||
KeyToExport="K_SLASH"
|
||||
if event.key == K_0:
|
||||
print "0 -> " + str(event.key)
|
||||
KeyToExport="K_0"
|
||||
if event.key == K_1:
|
||||
print "1 -> " + str(event.key)
|
||||
KeyToExport="K_1"
|
||||
if event.key == K_2:
|
||||
print "2 -> " + str(event.key)
|
||||
KeyToExport="K_2"
|
||||
if event.key == K_3:
|
||||
print "3 -> " + str(event.key)
|
||||
KeyToExport="K_3"
|
||||
if event.key == K_4:
|
||||
print "4 -> " + str(event.key)
|
||||
KeyToExport="K_4"
|
||||
if event.key == K_5:
|
||||
print "5 -> " + str(event.key)
|
||||
KeyToExport="K_5"
|
||||
if event.key == K_6:
|
||||
print "6 -> " + str(event.key)
|
||||
KeyToExport="K_6"
|
||||
if event.key == K_7:
|
||||
print "7 -> " + str(event.key)
|
||||
KeyToExport="K_7"
|
||||
if event.key == K_8:
|
||||
print "8 -> " + str(event.key)
|
||||
KeyToExport="K_8"
|
||||
if event.key == K_9:
|
||||
print "9 -> " + str(event.key)
|
||||
KeyToExport="K_9"
|
||||
if event.key == K_COLON:
|
||||
print "colon -> " + str(event.key)
|
||||
KeyToExport="K_COLON"
|
||||
if event.key == K_SEMICOLON:
|
||||
print "semicolon -> " + str(event.key)
|
||||
KeyToExport="K_SEMICOLON"
|
||||
if event.key == K_LESS:
|
||||
print "less -> " + str(event.key)
|
||||
KeyToExport="K_LESS"
|
||||
if event.key == K_EQUALS:
|
||||
print "equals -> " + str(event.key)
|
||||
KeyToExport="K_EQUALS"
|
||||
if event.key == K_GREATER:
|
||||
print "greater -> " + str(event.key)
|
||||
KeyToExport="K_GREATER"
|
||||
if event.key == K_QUESTION:
|
||||
print "question -> " + str(event.key)
|
||||
KeyToExport="K_QUESTION"
|
||||
if event.key == K_AT:
|
||||
print "at -> " + str(event.key)
|
||||
KeyToExport="K_AT"
|
||||
if event.key == K_LEFTBRACKET:
|
||||
print "leftbracket -> " + str(event.key)
|
||||
KeyToExport="K_LEFTBRACKET"
|
||||
if event.key == K_BACKSLASH:
|
||||
print "backslash -> " + str(event.key)
|
||||
KeyToExport="K_BACKSLASH"
|
||||
if event.key == K_RIGHTBRACKET:
|
||||
print "rightbracket -> " + str(event.key)
|
||||
KeyToExport="K_RIGHTBRACKET"
|
||||
if event.key == K_CARET:
|
||||
print "caret -> " + str(event.key)
|
||||
KeyToExport="K_CARET"
|
||||
if event.key == K_UNDERSCORE:
|
||||
print "underscore -> " + str(event.key)
|
||||
KeyToExport="K_UNDERSCORE"
|
||||
if event.key == K_BACKQUOTE:
|
||||
print "backquote -> " + str(event.key)
|
||||
KeyToExport="K_BACKQUOTE"
|
||||
if event.key == K_a:
|
||||
print "a -> " + str(event.key)
|
||||
KeyToExport="K_a"
|
||||
if event.key == K_b:
|
||||
print "b -> " + str(event.key)
|
||||
KeyToExport="K_b"
|
||||
if event.key == K_c:
|
||||
print "c -> " + str(event.key)
|
||||
KeyToExport="K_c"
|
||||
if event.key == K_d:
|
||||
print "d -> " + str(event.key)
|
||||
KeyToExport="K_d"
|
||||
if event.key == K_e:
|
||||
print "e -> " + str(event.key)
|
||||
KeyToExport="K_e"
|
||||
if event.key == K_f:
|
||||
print "f -> " + str(event.key)
|
||||
KeyToExport="K_f"
|
||||
if event.key == K_g:
|
||||
print "g -> " + str(event.key)
|
||||
KeyToExport="K_g"
|
||||
if event.key == K_h:
|
||||
print "h -> " + str(event.key)
|
||||
KeyToExport="K_h"
|
||||
if event.key == K_i:
|
||||
print "i -> " + str(event.key)
|
||||
KeyToExport="K_i"
|
||||
if event.key == K_j:
|
||||
print "j -> " + str(event.key)
|
||||
KeyToExport="K_j"
|
||||
if event.key == K_k:
|
||||
print "k -> " + str(event.key)
|
||||
KeyToExport="K_k"
|
||||
if event.key == K_l:
|
||||
print "l -> " + str(event.key)
|
||||
KeyToExport="K_l"
|
||||
if event.key == K_m:
|
||||
print "m -> " + str(event.key)
|
||||
KeyToExport="K_m"
|
||||
if event.key == K_n:
|
||||
print "n -> " + str(event.key)
|
||||
KeyToExport="K_n"
|
||||
if event.key == K_o:
|
||||
print "o -> " + str(event.key)
|
||||
KeyToExport="K_o"
|
||||
if event.key == K_p:
|
||||
print "p -> " + str(event.key)
|
||||
KeyToExport="K_p"
|
||||
if event.key == K_q:
|
||||
print "q -> " + str(event.key)
|
||||
KeyToExport="K_q"
|
||||
if event.key == K_r:
|
||||
print "r -> " + str(event.key)
|
||||
KeyToExport="K_r"
|
||||
if event.key == K_s:
|
||||
print "s -> " + str(event.key)
|
||||
KeyToExport="K_s"
|
||||
if event.key == K_t:
|
||||
print "t -> " + str(event.key)
|
||||
KeyToExport="K_t"
|
||||
if event.key == K_u:
|
||||
print "u -> " + str(event.key)
|
||||
KeyToExport="K_u"
|
||||
if event.key == K_v:
|
||||
print "v -> " + str(event.key)
|
||||
KeyToExport="K_v"
|
||||
if event.key == K_w:
|
||||
print "w -> " + str(event.key)
|
||||
KeyToExport="K_w"
|
||||
if event.key == K_x:
|
||||
print "x -> " + str(event.key)
|
||||
KeyToExport="K_x"
|
||||
if event.key == K_y:
|
||||
print "y -> " + str(event.key)
|
||||
KeyToExport="K_y"
|
||||
if event.key == K_z:
|
||||
print "z -> " + str(event.key)
|
||||
KeyToExport="K_z"
|
||||
if event.key == K_DELETE:
|
||||
print "delete -> " + str(event.key)
|
||||
KeyToExport="K_DELETE"
|
||||
if event.key == K_KP0:
|
||||
print "kp0 -> " + str(event.key)
|
||||
KeyToExport="K_KP0"
|
||||
if event.key == K_KP1:
|
||||
print "kp1 -> " + str(event.key)
|
||||
KeyToExport="K_KP1"
|
||||
if event.key == K_KP2:
|
||||
print "kp2 -> " + str(event.key)
|
||||
KeyToExport="K_KP2"
|
||||
if event.key == K_KP3:
|
||||
print "kp3 -> " + str(event.key)
|
||||
KeyToExport="K_KP3"
|
||||
if event.key == K_KP4:
|
||||
print "kp4 -> " + str(event.key)
|
||||
KeyToExport="K_KP4"
|
||||
if event.key == K_KP5:
|
||||
print "kp5 -> " + str(event.key)
|
||||
KeyToExport="K_KP5"
|
||||
if event.key == K_KP6:
|
||||
print "kp6 -> " + str(event.key)
|
||||
KeyToExport="K_KP6"
|
||||
if event.key == K_KP7:
|
||||
print "kp7 -> " + str(event.key)
|
||||
KeyToExport="K_KP7"
|
||||
if event.key == K_KP8:
|
||||
print "kp8 -> " + str(event.key)
|
||||
KeyToExport="K_KP8"
|
||||
if event.key == K_KP9:
|
||||
print "kp9 -> " + str(event.key)
|
||||
KeyToExport="K_KP9"
|
||||
if event.key == K_KP_PERIOD:
|
||||
print "kp_period -> " + str(event.key)
|
||||
KeyToExport="K_KP_PERIOD"
|
||||
if event.key == K_KP_DIVIDE:
|
||||
print "kp_divide -> " + str(event.key)
|
||||
KeyToExport="K_KP_DIVIDE"
|
||||
if event.key == K_KP_MULTIPLY:
|
||||
print "kp_multiply -> " + str(event.key)
|
||||
KeyToExport="K_KP_MULTIPLY"
|
||||
if event.key == K_KP_MINUS:
|
||||
print "kp_minus -> " + str(event.key)
|
||||
KeyToExport="K_KP_MINUS"
|
||||
if event.key == K_KP_PLUS:
|
||||
print "kp_plus -> " + str(event.key)
|
||||
KeyToExport="K_KP_PLUS"
|
||||
if event.key == K_KP_ENTER:
|
||||
print "kp_enter -> " + str(event.key)
|
||||
KeyToExport="K_KP_ENTER"
|
||||
if event.key == K_KP_EQUALS:
|
||||
print "kp_equals -> " + str(event.key)
|
||||
KeyToExport="K_KP_EQUALS"
|
||||
if event.key == K_UP:
|
||||
print "up -> " + str(event.key)
|
||||
KeyToExport="K_UP"
|
||||
if event.key == K_DOWN:
|
||||
print "down -> " + str(event.key)
|
||||
KeyToExport="K_DOWN"
|
||||
if event.key == K_RIGHT:
|
||||
print "right -> " + str(event.key)
|
||||
KeyToExport="K_RIGHT"
|
||||
if event.key == K_LEFT:
|
||||
print "left -> " + str(event.key)
|
||||
KeyToExport="K_LEFT"
|
||||
if event.key == K_INSERT:
|
||||
print "insert -> " + str(event.key)
|
||||
KeyToExport="K_INSERT"
|
||||
if event.key == K_HOME:
|
||||
print "home -> " + str(event.key)
|
||||
KeyToExport="K_HOME"
|
||||
if event.key == K_END:
|
||||
print "end -> " + str(event.key)
|
||||
KeyToExport="K_END"
|
||||
if event.key == K_PAGEUP:
|
||||
print "pageup -> " + str(event.key)
|
||||
KeyToExport="K_PAGEUP"
|
||||
if event.key == K_PAGEDOWN:
|
||||
print "pagedown -> " + str(event.key)
|
||||
KeyToExport="K_PAGEDOWN"
|
||||
if event.key == K_F1:
|
||||
print "f1 -> " + str(event.key)
|
||||
KeyToExport="K_F1"
|
||||
if event.key == K_F2:
|
||||
print "f2 -> " + str(event.key)
|
||||
KeyToExport="K_F2"
|
||||
if event.key == K_F3:
|
||||
print "f3 -> " + str(event.key)
|
||||
KeyToExport="K_F3"
|
||||
if event.key == K_F4:
|
||||
print "f4 -> " + str(event.key)
|
||||
KeyToExport="K_F4"
|
||||
if event.key == K_F5:
|
||||
print "f5 -> " + str(event.key)
|
||||
KeyToExport="K_F5"
|
||||
if event.key == K_F6:
|
||||
print "f6 -> " + str(event.key)
|
||||
KeyToExport="K_F6"
|
||||
if event.key == K_F7:
|
||||
print "f7 -> " + str(event.key)
|
||||
KeyToExport="K_F7"
|
||||
if event.key == K_F8:
|
||||
print "f8 -> " + str(event.key)
|
||||
KeyToExport="K_F8"
|
||||
if event.key == K_F9:
|
||||
print "f9 -> " + str(event.key)
|
||||
KeyToExport="K_F9"
|
||||
if event.key == K_F10:
|
||||
print "f10 -> " + str(event.key)
|
||||
KeyToExport="K_F10"
|
||||
if event.key == K_F11:
|
||||
print "f11 -> " + str(event.key)
|
||||
KeyToExport="K_F11"
|
||||
if event.key == K_F12:
|
||||
print "f12 -> " + str(event.key)
|
||||
KeyToExport="K_F12"
|
||||
if event.key == K_F13:
|
||||
print "f13 -> " + str(event.key)
|
||||
KeyToExport="K_F13"
|
||||
if event.key == K_F14:
|
||||
print "f14 -> " + str(event.key)
|
||||
KeyToExport="K_F14"
|
||||
if event.key == K_F15:
|
||||
print "f15 -> " + str(event.key)
|
||||
KeyToExport="K_F15"
|
||||
if event.key == K_NUMLOCK:
|
||||
print "numlock -> " + str(event.key)
|
||||
KeyToExport="K_NUMLOCK"
|
||||
if event.key == K_CAPSLOCK:
|
||||
print "capslock -> " + str(event.key)
|
||||
KeyToExport="K_CAPSLOCK"
|
||||
if event.key == K_SCROLLOCK:
|
||||
print "scrollock -> " + str(event.key)
|
||||
KeyToExport="K_SCROLLOCK"
|
||||
if event.key == K_RSHIFT:
|
||||
print "rshift -> " + str(event.key)
|
||||
KeyToExport="K_RSHIFT"
|
||||
if event.key == K_LSHIFT:
|
||||
print "lshift -> " + str(event.key)
|
||||
KeyToExport="K_LSHIFT"
|
||||
if event.key == K_RCTRL:
|
||||
print "rctrl -> " + str(event.key)
|
||||
KeyToExport="K_RCTRL"
|
||||
if event.key == K_LCTRL:
|
||||
print "lctrl -> " + str(event.key)
|
||||
KeyToExport="K_LCTRL"
|
||||
if event.key == K_RALT:
|
||||
print "ralt -> " + str(event.key)
|
||||
KeyToExport="K_RALT"
|
||||
if event.key == K_LALT:
|
||||
print "lalt -> " + str(event.key)
|
||||
KeyToExport="K_LALT"
|
||||
if event.key == K_RMETA:
|
||||
print "rmeta -> " + str(event.key)
|
||||
KeyToExport="K_RMETA"
|
||||
if event.key == K_LMETA:
|
||||
print "lmeta -> " + str(event.key)
|
||||
KeyToExport="K_LMETA"
|
||||
if event.key == K_LSUPER:
|
||||
print "lsuper -> " + str(event.key)
|
||||
KeyToExport="K_LSUPER"
|
||||
if event.key == K_RSUPER:
|
||||
print "rsuper -> " + str(event.key)
|
||||
KeyToExport="K_RSUPER"
|
||||
if event.key == K_MODE:
|
||||
print "mode -> " + str(event.key)
|
||||
KeyToExport="K_MODE"
|
||||
if event.key == K_HELP:
|
||||
print "help -> " + str(event.key)
|
||||
KeyToExport="K_HELP"
|
||||
if event.key == K_PRINT:
|
||||
print "print -> " + str(event.key)
|
||||
KeyToExport="K_PRINT"
|
||||
if event.key == K_SYSREQ:
|
||||
print "sysreq -> " + str(event.key)
|
||||
KeyToExport="K_SYSREQ"
|
||||
if event.key == K_BREAK:
|
||||
print "break -> " + str(event.key)
|
||||
KeyToExport="K_BREAK"
|
||||
if event.key == K_MENU:
|
||||
print "menu -> " + str(event.key)
|
||||
KeyToExport="K_MENU"
|
||||
if event.key == K_POWER:
|
||||
print "power -> " + str(event.key)
|
||||
KeyToExport="K_POWER"
|
||||
if event.key == K_EURO:
|
||||
print "euro -> " + str(event.key)
|
||||
KeyToExport="K_EURO"
|
||||
|
||||
|
||||
|
||||
if TDiff != 0:
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
PyrScreen.blit(text2,(WHERE_TEXTE))
|
||||
PyrScreen.blit(PngKeyPushObj,WHERE_IMG),(SIZE_IMG_BTN,SIZE_IMG_BTN)
|
||||
|
||||
if TDiff == -1:
|
||||
print str(KeyPush) + " = No touch"
|
||||
T1 = 0
|
||||
KeyToExport="NULL"
|
||||
|
||||
#pygame.time.wait(10)
|
||||
file.write(str(KeyPush) + " = " + str(KeyToExport) + "\n")
|
||||
|
||||
|
||||
KeyToExport="NULL"
|
||||
|
||||
#pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
|
||||
# PyrScreen.blit(fond, (0,0))
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
pygame.display.update()
|
||||
pygame.display.update()
|
||||
|
||||
file.close()
|
||||
|
||||
16
BIN/FBA.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/FBA/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/FBA.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
31
BIN/FILE_EDITOR.py
Executable file
@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding: utf-8 -*-
|
||||
# pyrharckade 2 is a simple pygame front for PIMAME
|
||||
# version: 2.0A
|
||||
# guillaume@tuxme.net
|
||||
# GPL Licence
|
||||
|
||||
from Tkinter import *
|
||||
import os
|
||||
FILE='../ROM_CONFIG_FILES.csv'
|
||||
def SaveFile():
|
||||
open(FILE, "w").write(text.get(0., END))
|
||||
|
||||
TkBackupFile = Tk()
|
||||
TkBackupFile.title('ROM_CONFIG_FILES.csv Editor')
|
||||
BoutonSave = Button(TkBackupFile, text ='Save',command=SaveFile)
|
||||
BoutonQuit = Button(TkBackupFile, text ='Quit',command=TkBackupFile.quit)
|
||||
|
||||
BoutonSave.grid(row =0, column =0)
|
||||
BoutonSave.configure()
|
||||
BoutonQuit.grid(row =0, column =1)
|
||||
BoutonQuit.configure()
|
||||
|
||||
text = Text()
|
||||
if os.path.exists(FILE):
|
||||
text.insert(1.,open(FILE,'r').read())
|
||||
else:
|
||||
text.insert(1.,open(FILE,'w+').read())
|
||||
text.grid(row=1, column=0, columnspan=25, sticky=N, padx=2, pady=2)
|
||||
entree = Entry(TkBackupFile)
|
||||
TkBackupFile.mainloop()
|
||||
16
BIN/GAMEBOY.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/GAMEBOY/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/GAMEBOY.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
16
BIN/GAW.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/GAW/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/GAW.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
17
BIN/GNGEO.sh
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/GNGEO/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/FBA.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
echo ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
413
BIN/GetListAndGame.py
Executable file
@ -0,0 +1,413 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding: utf-8 -*-
|
||||
# pyrharckade 2 is a simple pygame front for PIMAME
|
||||
# version: 2.0A
|
||||
# guillaume@tuxme.net
|
||||
# GPL Licence
|
||||
|
||||
import glob
|
||||
|
||||
|
||||
|
||||
import os, sys, pygame, pygame.font, pygame.image,subprocess, sys, time
|
||||
sys.path.insert(0, '../CONF/')
|
||||
|
||||
import os
|
||||
from ConfAllPath import *
|
||||
from KeyMapKeyBoard import *
|
||||
import shutil
|
||||
from DefDownladPerGame import DownloadGraphical
|
||||
if not glob.glob("ROM_CONFIG_FILES.csv"):
|
||||
DownloadGraphical("SYS","ROM_CONFIG_FILES")
|
||||
shutil.move("../MEDIA/SYS/ROMS/ROM_CONFIG_FILES.csv","./ROM_CONFIG_FILES.csv")
|
||||
|
||||
|
||||
|
||||
from pygame.locals import *
|
||||
from DefReadConfRomFile import DefReadConfRom
|
||||
from ConfAllPath import DefConfPathHome
|
||||
import urllib2
|
||||
import math
|
||||
import subprocess
|
||||
from DefResAndSysFile import *
|
||||
from DefCheckEnvFile import DefCheckEnv
|
||||
Resolution=DefResolution()
|
||||
ParentOfPyr,ConfRomFile,AllMedia,ConfigKeyboardFile=DefConfPathHome()
|
||||
Sys=DefCheckEnv()
|
||||
MAX, MAX_EMU,li,emu=DefReadConfRom(ConfRomFile)
|
||||
pygame.joystick.init()
|
||||
if pygame.joystick.get_count() != 0:
|
||||
mon_joystick = pygame.joystick.Joystick(0)
|
||||
mon_joystick.init()
|
||||
JOY_TEST = 1
|
||||
if HACK_KEY_CARD == 'Y':
|
||||
JOY_TEST = 0
|
||||
else:
|
||||
JOY_TEST = 0
|
||||
|
||||
|
||||
|
||||
pygame.init()
|
||||
|
||||
print "MAX: " + str(MAX)
|
||||
print "MAX_EMU: " + str(MAX_EMU)
|
||||
|
||||
|
||||
|
||||
|
||||
finished = 0
|
||||
|
||||
|
||||
### PROD
|
||||
pygame.init()
|
||||
Y,X=Resolution
|
||||
PyrScreen = pygame.display.set_mode(Resolution,FULLSCREEN)
|
||||
|
||||
### TEST
|
||||
#Y,X=(800,600)
|
||||
#Resolution=(Y,X)
|
||||
#PyrScreen = pygame.display.set_mode(Resolution)
|
||||
|
||||
|
||||
Space_bar=20
|
||||
XBAR=(Y-(Y/Space_bar))
|
||||
YBAR=(X/10)
|
||||
WHERE_XBAR=Space_bar
|
||||
WHERE_YBAR=(Y/2) - (YBAR/2)
|
||||
|
||||
fg = 250, 240, 230
|
||||
bg = 5, 5, 5
|
||||
|
||||
|
||||
fond = pygame.transform.scale(pygame.image.load("KEY/background.png").convert(),Resolution)
|
||||
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
time.sleep(0.8)
|
||||
FontSize=(Y/20)
|
||||
|
||||
font = pygame.font.Font('../MEDIA/font.ttf', FontSize)
|
||||
font_big = pygame.font.Font('../MEDIA/font.ttf', FontSize+10)
|
||||
SCREEN_W,SCREEN_H = Resolution
|
||||
|
||||
resolution=SCREEN_W,SCREEN_H
|
||||
|
||||
SIZE_IMG_BTN=400
|
||||
|
||||
WHERE_IMG_X = int(SCREEN_W /3)
|
||||
WHERE_IMG_Y = int(SCREEN_H /2) - int(SIZE_IMG_BTN/2)
|
||||
WHERE_IMG = (WHERE_IMG_X,WHERE_IMG_Y)
|
||||
WHERE_TEXTE_X = int(SCREEN_W /4)
|
||||
WHERE_TEXTE_Y = int(SCREEN_H /2)
|
||||
WHERE_TEXTE=(WHERE_TEXTE_X,WHERE_TEXTE_Y)
|
||||
|
||||
|
||||
WHERE_TEXTE_1U=(WHERE_TEXTE_X,WHERE_TEXTE_Y+50)
|
||||
WHERE_TEXTE_2U=(WHERE_TEXTE_X,WHERE_TEXTE_Y+100)
|
||||
WHERE_TEXTE_3U=(WHERE_TEXTE_X,WHERE_TEXTE_Y+150)
|
||||
WHERE_TEXTE_4U=(WHERE_TEXTE_X,WHERE_TEXTE_Y+200)
|
||||
WHERE_TEXTE_5U=(WHERE_TEXTE_X,WHERE_TEXTE_Y+250)
|
||||
WHERE_TEXTE_1D=(WHERE_TEXTE_X,WHERE_TEXTE_Y-50)
|
||||
WHERE_TEXTE_2D=(WHERE_TEXTE_X,WHERE_TEXTE_Y-100)
|
||||
WHERE_TEXTE_3D=(WHERE_TEXTE_X,WHERE_TEXTE_Y-150)
|
||||
WHERE_TEXTE_4D=(WHERE_TEXTE_X,WHERE_TEXTE_Y-200)
|
||||
WHERE_TEXTE_5D=(WHERE_TEXTE_X,WHERE_TEXTE_Y-250)
|
||||
|
||||
|
||||
KeyToExport="RUN"
|
||||
CPT=0
|
||||
NMAX=-MAX
|
||||
MAX=MAX-1
|
||||
AddInRegularConfFile="N"
|
||||
|
||||
text1 = "Touch any key to generate list"
|
||||
text2 = font.render(text1, True, fg)
|
||||
|
||||
PyrScreen.blit(text2,(WHERE_TEXTE))
|
||||
pygame.key.set_repeat(400, 70)
|
||||
if CPT>MAX:
|
||||
CPT=NMAX
|
||||
if CPT<NMAX:
|
||||
CPT=MAX-1
|
||||
|
||||
|
||||
|
||||
CPT_1U=CPT-1
|
||||
if CPT_1U<NMAX:
|
||||
#CPT_1U=-(CPT+1)
|
||||
CPT_1U=-(NMAX+1)
|
||||
CPT_2U=CPT-2
|
||||
if CPT_2U<NMAX:
|
||||
CPT_2U=-(NMAX+2)
|
||||
CPT_3U=CPT-3
|
||||
if CPT_3U<NMAX:
|
||||
CPT_3U=-(NMAX+3)
|
||||
CPT_4U=CPT-4
|
||||
if CPT_4U<NMAX:
|
||||
CPT_4U=-(NMAX+4)
|
||||
CPT_5U=CPT-5
|
||||
if CPT_5U<NMAX:
|
||||
CPT_5U=-(NMAX+5)
|
||||
|
||||
CPT_1D=CPT+1
|
||||
if CPT_1D>MAX:
|
||||
CPT_1D=NMAX+CPT+1
|
||||
CPT_2D=CPT+2
|
||||
if CPT_2D>MAX:
|
||||
CPT_2D=NMAX+CPT+2
|
||||
CPT_3D=CPT+3
|
||||
if CPT_3D>MAX:
|
||||
CPT_3D=NMAX+CPT+3
|
||||
CPT_4D=CPT+4
|
||||
if CPT_4D>MAX:
|
||||
CPT_4D=NMAX+CPT+4
|
||||
CPT_5D=CPT+5
|
||||
if CPT_5D>MAX:
|
||||
CPT_5D=NMAX+CPT+5
|
||||
|
||||
while KeyToExport != "ESC" :
|
||||
for event in pygame.event.get():
|
||||
if JOY_TEST != 0 :
|
||||
if event.type == JOYAXISMOTION:
|
||||
if event.axis == 1 and event.value > 0:
|
||||
CPT=CPT-1
|
||||
if event.axis == 1 and event.value < 0:
|
||||
CPT=CPT-1
|
||||
if event.axis == 0 and event.value < 0:
|
||||
ROM_L1 = li[CPT][0][0]
|
||||
ROM_L2 = ROM_L1
|
||||
while (ROM_L1 == ROM_L2):
|
||||
CPT = CPT - 1
|
||||
if CPT>MAX:
|
||||
CPT=NMAX
|
||||
if CPT<NMAX:
|
||||
CPT=MAX-1
|
||||
|
||||
ROM_L1 = li[CPT][0][0]
|
||||
|
||||
if event.axis == 0 and event.value > 0:
|
||||
ROM_L1 = li[CPT][0][0]
|
||||
ROM_L2 = ROM_L1
|
||||
while (ROM_L1 == ROM_L2):
|
||||
CPT = CPT +1
|
||||
if CPT>MAX:
|
||||
CPT=NMAX
|
||||
if CPT<NMAX:
|
||||
CPT=MAX-1
|
||||
|
||||
ROM_L1 = li[CPT][0][0]
|
||||
|
||||
if event.type == JOYBUTTONDOWN and event.button == BTN_J1_1:
|
||||
DownloadGraphical(str(li[CPT][1]), str(li[CPT][0]))
|
||||
pygame.display.update()
|
||||
CheckStringConf=str(li[CPT][0])+','+str(li[CPT][1])
|
||||
ConfFile = open("../ROM_CONFIG_FILES.csv","r")
|
||||
for ConfFileLine in ConfFile:
|
||||
if CheckStringConf in ConfFileLine:
|
||||
AddInRegularConfFile="Y"
|
||||
ConfFile.close()
|
||||
if AddInRegularConfFile != "Y":
|
||||
with open("../ROM_CONFIG_FILES.csv",'ab') as f: f.write(str(li[CPT][0])+','+str(li[CPT][1])+"\n")
|
||||
|
||||
|
||||
if event.type == JOYBUTTONDOWN and event.button == BTN_J1_1:
|
||||
print "escape -> " + str(event.button )
|
||||
KeyToExport="ESC"
|
||||
|
||||
if CPT>MAX:
|
||||
CPT=NMAX
|
||||
if CPT<NMAX:
|
||||
CPT=MAX-1
|
||||
|
||||
|
||||
|
||||
CPT_1U=CPT-1
|
||||
if CPT_1U<NMAX:
|
||||
#CPT_1U=-(CPT+1)
|
||||
CPT_1U=-(NMAX+1)
|
||||
CPT_2U=CPT-2
|
||||
if CPT_2U<NMAX:
|
||||
CPT_2U=-(NMAX+2)
|
||||
CPT_3U=CPT-3
|
||||
if CPT_3U<NMAX:
|
||||
CPT_3U=-(NMAX+3)
|
||||
CPT_4U=CPT-4
|
||||
if CPT_4U<NMAX:
|
||||
CPT_4U=-(NMAX+4)
|
||||
CPT_5U=CPT-5
|
||||
if CPT_5U<NMAX:
|
||||
CPT_5U=-(NMAX+5)
|
||||
|
||||
CPT_1D=CPT+1
|
||||
if CPT_1D>MAX:
|
||||
CPT_1D=NMAX+CPT+1
|
||||
CPT_2D=CPT+2
|
||||
if CPT_2D>MAX:
|
||||
CPT_2D=NMAX+CPT+2
|
||||
CPT_3D=CPT+3
|
||||
if CPT_3D>MAX:
|
||||
CPT_3D=NMAX+CPT+3
|
||||
CPT_4D=CPT+4
|
||||
if CPT_4D>MAX:
|
||||
CPT_4D=NMAX+CPT+4
|
||||
CPT_5D=CPT+5
|
||||
if CPT_5D>MAX:
|
||||
CPT_5D=NMAX+CPT+5
|
||||
if JOY_TEST == 0 :
|
||||
|
||||
if CPT>MAX:
|
||||
CPT=NMAX
|
||||
if CPT<NMAX:
|
||||
CPT=MAX-1
|
||||
|
||||
|
||||
|
||||
CPT_1U=CPT-1
|
||||
if CPT_1U<NMAX:
|
||||
#CPT_1U=-(CPT+1)
|
||||
CPT_1U=-(NMAX+1)
|
||||
CPT_2U=CPT-2
|
||||
if CPT_2U<NMAX:
|
||||
CPT_2U=-(NMAX+2)
|
||||
CPT_3U=CPT-3
|
||||
if CPT_3U<NMAX:
|
||||
CPT_3U=-(NMAX+3)
|
||||
CPT_4U=CPT-4
|
||||
if CPT_4U<NMAX:
|
||||
CPT_4U=-(NMAX+4)
|
||||
CPT_5U=CPT-5
|
||||
if CPT_5U<NMAX:
|
||||
CPT_5U=-(NMAX+5)
|
||||
|
||||
CPT_1D=CPT+1
|
||||
if CPT_1D>MAX:
|
||||
CPT_1D=NMAX+CPT+1
|
||||
CPT_2D=CPT+2
|
||||
if CPT_2D>MAX:
|
||||
CPT_2D=NMAX+CPT+2
|
||||
CPT_3D=CPT+3
|
||||
if CPT_3D>MAX:
|
||||
CPT_3D=NMAX+CPT+3
|
||||
CPT_4D=CPT+4
|
||||
if CPT_4D>MAX:
|
||||
CPT_4D=NMAX+CPT+4
|
||||
CPT_5D=CPT+5
|
||||
if CPT_5D>MAX:
|
||||
CPT_5D=NMAX+CPT+5
|
||||
|
||||
|
||||
|
||||
|
||||
if event.type == KEYDOWN:
|
||||
if event.key == BTN_J1_2:
|
||||
print "escape -> " + str(event.key)
|
||||
KeyToExport="ESC"
|
||||
|
||||
if event.key == DOWN_J1:
|
||||
CPT=CPT-1
|
||||
if event.key == UP_J1:
|
||||
CPT=CPT+1
|
||||
if event.key == LEFT_J1:
|
||||
ROM_L1 = li[CPT][0][0]
|
||||
ROM_L2 = ROM_L1
|
||||
while (ROM_L1 == ROM_L2):
|
||||
CPT = CPT - 1
|
||||
if CPT>MAX:
|
||||
CPT=NMAX
|
||||
if CPT<NMAX:
|
||||
CPT=MAX-1
|
||||
|
||||
ROM_L1 = li[CPT][0][0]
|
||||
if event.key == RIGHT_J1:
|
||||
ROM_L1 = li[CPT][0][0]
|
||||
ROM_L2 = ROM_L1
|
||||
while (ROM_L1 == ROM_L2):
|
||||
CPT = CPT +1
|
||||
if CPT>MAX:
|
||||
CPT=NMAX
|
||||
if CPT<NMAX:
|
||||
CPT=MAX-1
|
||||
|
||||
ROM_L1 = li[CPT][0][0]
|
||||
|
||||
if event.key == BTN_J1_1:
|
||||
DownloadGraphical(str(li[CPT][1]), str(li[CPT][0]))
|
||||
pygame.display.update()
|
||||
CheckStringConf=str(li[CPT][0])+','+str(li[CPT][1])
|
||||
ConfFile = open("../ROM_CONFIG_FILES.csv","r")
|
||||
for ConfFileLine in ConfFile:
|
||||
if CheckStringConf in ConfFileLine:
|
||||
AddInRegularConfFile="Y"
|
||||
ConfFile.close()
|
||||
if AddInRegularConfFile != "Y":
|
||||
with open("../ROM_CONFIG_FILES.csv",'ab') as f: f.write(str(li[CPT][0])+','+str(li[CPT][1])+"\n")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
text_selection_1U = str(li[CPT_1U][0]) + " ("+ str(li[CPT_1U][1]) + ")"
|
||||
|
||||
#text_render_1U = font.render(text_selection_1U, True, fg)
|
||||
|
||||
text_render_1U = font.render(text_selection_1U, True, fg)
|
||||
|
||||
|
||||
|
||||
text_selection_2U = str(li[CPT_2U][0]) + " ("+ str(li[CPT_2U][1]) + ")"
|
||||
text_render_2U = font.render(text_selection_2U, True, fg)
|
||||
text_selection_3U = str(li[CPT_3U][0]) + " ("+ str(li[CPT_3U][1]) + ")"
|
||||
text_render_3U = font.render(text_selection_3U, True, fg)
|
||||
text_selection_4U = str(li[CPT_4U][0]) + " ("+ str(li[CPT_4U][1]) + ")"
|
||||
text_render_4U = font.render(text_selection_4U, True, fg)
|
||||
text_selection_5U = str(li[CPT_5U][0]) + " ("+ str(li[CPT_5U][1]) + ")"
|
||||
text_render_5U = font.render(text_selection_5U, True, fg)
|
||||
text_selection_5D = str(li[CPT_5D][0]) + " ("+ str(li[CPT_5D][1]) + ")"
|
||||
text_render_5D = font.render(text_selection_5D, True, fg)
|
||||
text_selection_4D = str(li[CPT_4D][0]) + " ("+ str(li[CPT_4D][1]) + ")"
|
||||
text_render_4D = font.render(text_selection_4D, True, fg)
|
||||
text_selection_3D = str(li[CPT_3D][0]) + " ("+ str(li[CPT_3D][1]) + ")"
|
||||
text_render_3D = font.render(text_selection_3D, True, fg)
|
||||
text_selection_2D = str(li[CPT_2D][0]) + " ("+ str(li[CPT_2D][1]) + ")"
|
||||
text_render_2D = font.render(text_selection_2D, True, fg)
|
||||
text_selection_1D = str(li[CPT_1D][0]) + " ("+ str(li[CPT_1D][1]) + ")"
|
||||
text_render_1D = font.render(text_selection_1D, True, fg)
|
||||
|
||||
|
||||
|
||||
|
||||
text_selection = str(li[CPT][0]) + " ("+ str(li[CPT][1]) + ")"
|
||||
PATH_TEST="../MEDIA/"+str(li[CPT][1])+"/ROMS/"+str(li[CPT][0])+"*"
|
||||
#print str(PATH_TEST)
|
||||
# if not os.path.exists(PATH_TEST):
|
||||
if glob.glob(PATH_TEST):
|
||||
text_render = font_big.render(text_selection, True, pygame.Color("green"), pygame.Color("white"))
|
||||
else:
|
||||
text_render = font_big.render(text_selection, True, pygame.Color("red"), pygame.Color("white"))
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
PyrScreen.blit(text_render_5U,(WHERE_TEXTE_5U))
|
||||
PyrScreen.blit(text_render_4U,(WHERE_TEXTE_4U))
|
||||
PyrScreen.blit(text_render_3U,(WHERE_TEXTE_3U))
|
||||
PyrScreen.blit(text_render_2U,(WHERE_TEXTE_2U))
|
||||
PyrScreen.blit(text_render_1U,(WHERE_TEXTE_1U))
|
||||
|
||||
PyrScreen.blit(text_render_5D,(WHERE_TEXTE_5D))
|
||||
PyrScreen.blit(text_render_4D,(WHERE_TEXTE_4D))
|
||||
PyrScreen.blit(text_render_3D,(WHERE_TEXTE_3D))
|
||||
PyrScreen.blit(text_render_2D,(WHERE_TEXTE_2D))
|
||||
PyrScreen.blit(text_render_1D,(WHERE_TEXTE_1D))
|
||||
|
||||
PyrScreen.blit(text_render,(WHERE_TEXTE))
|
||||
|
||||
pygame.display.update()
|
||||
|
||||
pygame.display.update()
|
||||
|
||||
#file.close()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
BIN/KEY/BTN.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
BIN/KEY/BTN_HACK.png
Normal file
|
After Width: | Height: | Size: 9.2 KiB |
BIN
BIN/KEY/BTN_J1_1.png
Normal file
|
After Width: | Height: | Size: 70 KiB |
BIN
BIN/KEY/BTN_J1_2.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
BIN/KEY/BTN_J1_3.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
BIN/KEY/BTN_J1_4.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
BIN/KEY/BTN_J1_5.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
BIN/KEY/BTN_J1_6.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
BIN/KEY/BTN_J2_1.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
BIN/KEY/BTN_J2_2.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
BIN/KEY/BTN_J2_3.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
BIN/KEY/BTN_J2_4.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
BIN/KEY/BTN_J2_5.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
BIN/KEY/BTN_J2_6.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
BIN/KEY/COIN_J1.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
BIN/KEY/COIN_J2.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
BIN/KEY/DOWN_J1.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
BIN/KEY/DOWN_J2.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
BIN/KEY/LEFT_J1.png
Normal file
|
After Width: | Height: | Size: 7.6 KiB |
BIN
BIN/KEY/LEFT_J2.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
BIN/KEY/RIGHT_J1.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
BIN/KEY/RIGHT_J2.png
Normal file
|
After Width: | Height: | Size: 7.3 KiB |
BIN
BIN/KEY/SELECT_J1.png
Normal file
|
After Width: | Height: | Size: 71 KiB |
BIN
BIN/KEY/SELECT_J2.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
BIN/KEY/START_J1.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
BIN/KEY/START_J2.png
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
BIN/KEY/UP_J1.png
Normal file
|
After Width: | Height: | Size: 7.7 KiB |
BIN
BIN/KEY/UP_J2.png
Normal file
|
After Width: | Height: | Size: 7.2 KiB |
BIN
BIN/KEY/background.png
Normal file
|
After Width: | Height: | Size: 553 KiB |
BIN
BIN/KEY/background_key.png
Normal file
|
After Width: | Height: | Size: 537 KiB |
16
BIN/MAME.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/MAME/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/MAME.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -L ${BIN} -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
16
BIN/N64.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/N64/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/N64.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
16
BIN/NES.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/NES/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/NES.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
16
BIN/PS1.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/PS1/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/PS1.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
16
BIN/SNES.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
####### CONF ########
|
||||
ROM=$1
|
||||
SCREEN=$2
|
||||
PATH_ROMS=${HOME}/pyrharckade/MEDIA/SNES/ROMS/
|
||||
BIN=${HOME}/pyrharckade/BIN/LIBRETRO/SNES.so
|
||||
####### CONF ########
|
||||
cd $PATH_ROMS
|
||||
|
||||
${HOME}/pyrharckade/BIN/LIBRETRO/retroarch -c ${HOME}/pyrharckade/BIN/LIBRETRO/retroarch.cfg -L ${BIN} ${PATH_ROMS}/${ROM}.zip
|
||||
|
||||
###### RESTART PYR ######
|
||||
cd ${HOME}/pyrharckade/
|
||||
./start.py $SCREEN
|
||||
###### RESTART PYR ######
|
||||
112
BIN/SYS.sh
Executable file
@ -0,0 +1,112 @@
|
||||
#!/bin/bash
|
||||
SCREEN=$2
|
||||
|
||||
if [[ "$1" == "001_REBOOT" ]]
|
||||
then
|
||||
sudo reboot
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ "$1" == "001_HALT" ]]
|
||||
then
|
||||
sudo halt
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ "$1" == "001_MEDIA" ]]
|
||||
then
|
||||
cd BIN
|
||||
./get_media_graphical.sh
|
||||
cd ../
|
||||
./start.py $SCREEN
|
||||
|
||||
fi
|
||||
if [[ "$1" == "001_BIOS" ]]
|
||||
then
|
||||
cd BIN
|
||||
./get_BIOS.sh
|
||||
cd ../
|
||||
./start.py $SCREEN
|
||||
|
||||
fi
|
||||
if [[ "$1" == "001_RETROARCH" ]]
|
||||
then
|
||||
cd BIN
|
||||
./get_libretro_rpi_2_3.sh
|
||||
cd ../
|
||||
./start.py $SCREEN
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [[ "$1" == "001_VERIF" ]]
|
||||
then
|
||||
cd BIN
|
||||
./verif_roms.sh
|
||||
cd ../
|
||||
./start.py $SCREEN
|
||||
fi
|
||||
if [[ "$1" == "001_QUIT" ]]
|
||||
then
|
||||
echo "EXIT FE pyrharckade"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ "$1" == "001_EDIT" ]]
|
||||
then
|
||||
echo "EDIT ROM_CONFIG_FILES.csv pyrharckade"
|
||||
cd BIN
|
||||
./FILE_EDITOR.py
|
||||
cd ..
|
||||
./start.py $SCREEN
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$1" == "001_ALL_ROM" ]]
|
||||
then
|
||||
echo "GET ROM_CONFIG_FILES ALL ROMS pyrharckade"
|
||||
cd BIN
|
||||
./GetListAndGame.py
|
||||
cd ..
|
||||
./start.py $SCREEN
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
if [[ "$1" == "001_CONFIG_KEYBOARD" ]]
|
||||
then
|
||||
rm ./CONF/KeyMapKeyBoard.py*
|
||||
cd BIN
|
||||
|
||||
./ConfigKeyboard.py
|
||||
cd ..
|
||||
./start.py $SCREEN
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
if [[ "$1" == "001_GET_LIST" ]]
|
||||
then
|
||||
cd BIN
|
||||
./GetListAndGame.py
|
||||
cd ..
|
||||
./start.py $SCREEN
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
25
BIN/convert_dir_mp4_mpg.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
DIR_CONVERT=$1
|
||||
|
||||
if [[ ! -d $DIR_CONVERT ]]
|
||||
then
|
||||
echo "Select a valid dir"
|
||||
exit
|
||||
fi
|
||||
|
||||
cd $DIR_CONVERT
|
||||
if [[ ! -d CONVERT_FILE_MPG ]]
|
||||
then
|
||||
mkdir CONVERT_FILE_MPG
|
||||
fi
|
||||
for var in `ls -1 | grep -v CONVERT_FILE_MPG | cut -d"." -f1`
|
||||
do
|
||||
if [[ -f "CONVERT_FILE_MPG/${var}.mpg" ]]
|
||||
then
|
||||
echo "File CONVERT_FILE_MPG/${var}.mpg exist"
|
||||
else
|
||||
echo "${var}.mp4 -> CONVERT_FILE_MPG/${var}.mpg"
|
||||
ffmpeg -loglevel panic -i ${var}.mp4 -target ntsc-vcd CONVERT_FILE_MPG/${var}.mpg 2> /dev/null
|
||||
fi
|
||||
done
|
||||
BIN
BIN/download.png
Normal file
|
After Width: | Height: | Size: 636 KiB |
392
BIN/download_graphical.py
Executable file
@ -0,0 +1,392 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding: utf-8 -*-
|
||||
|
||||
import os, sys, pygame, pygame.font, pygame.image,subprocess, sys, time
|
||||
from pygame.locals import *
|
||||
sys.path.insert(0, '../CONF/')
|
||||
import urllib2
|
||||
from DefResAndSysFile import *
|
||||
from DefCheckEnvFile import DefCheckEnv
|
||||
Sys=DefSystem()
|
||||
Resolution=DefResolution()
|
||||
|
||||
def getSize(filename):
|
||||
st = os.stat(filename)
|
||||
return st.st_size
|
||||
|
||||
|
||||
pygame.init()
|
||||
|
||||
|
||||
|
||||
finished = 0
|
||||
|
||||
|
||||
Emu_Media=str(sys.argv[1])
|
||||
Media=str(sys.argv[2])
|
||||
|
||||
|
||||
if Emu_Media == "BIOS":
|
||||
Ext_Media=".tar.bz2"
|
||||
if Emu_Media == "LIBRETRO":
|
||||
Ext_Media=".so"
|
||||
|
||||
|
||||
if Emu_Media == "FBA" or Emu_Media == "CPS3" or Emu_Media == "GNGEO" or Emu_Media == "MAME" or Emu_Media == "CPS3":
|
||||
Emu_Media_url = "ARCADE"
|
||||
else:
|
||||
Emu_Media_url=Emu_Media
|
||||
|
||||
|
||||
### PROD
|
||||
pygame.init()
|
||||
Y,X=Resolution
|
||||
PyrScreen = pygame.display.set_mode(Resolution,FULLSCREEN)
|
||||
|
||||
### TEST
|
||||
#Y,X=(800,600)
|
||||
#Resolution=(Y,X)
|
||||
#PyrScreen = pygame.display.set_mode(Resolution)
|
||||
|
||||
|
||||
|
||||
|
||||
Space_bar=20
|
||||
XBAR=(Y-(Y/Space_bar))
|
||||
YBAR=(X/8)
|
||||
WHERE_XBAR=Space_bar
|
||||
WHERE_YBAR=(Y/2) - (YBAR/2)
|
||||
|
||||
|
||||
fond = pygame.transform.scale(pygame.image.load("download.png").convert(),Resolution)
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
time.sleep(0.8)
|
||||
pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
FontSize=(X/10)
|
||||
font = pygame.font.Font('../MEDIA/font.ttf', FontSize)
|
||||
GoToOne=0
|
||||
|
||||
|
||||
|
||||
|
||||
if Sys == "Darwin":
|
||||
Liste_media='SNAP','WHEEL','DOCS','ROMS'
|
||||
else :
|
||||
Liste_media='SNAP','WHEEL','DOCS','ROMS','VIDEO'
|
||||
|
||||
if Emu_Media == "LIBRETRO":
|
||||
Liste_media='RPI23'
|
||||
GoToOne=1
|
||||
if Emu_Media == "BIOS":
|
||||
Liste_media='ROMS'
|
||||
Media='BIOS'
|
||||
GoToOne=1
|
||||
|
||||
if GoToOne == 1:
|
||||
if Emu_Media == "LIBRETRO":
|
||||
Ext_Media=".so"
|
||||
url = "http://media.pyrharckade.io/"+ Emu_Media + "/" + Liste_media + "/" + Media + Ext_Media
|
||||
PathToDir='../BIN/'+ Emu_Media + '/'
|
||||
|
||||
if Media == "retroarch":
|
||||
Ext_Media=""
|
||||
url = "http://media.pyrharckade.io/"+ Emu_Media + "/" + Liste_media + "/" + Media + Ext_Media
|
||||
PathToDir='../BIN/'+ Emu_Media + '/'
|
||||
if Media == "config_libretro":
|
||||
Ext_Media=".cfg"
|
||||
url = "http://media.pyrharckade.io/"+ Emu_Media + "/" + Liste_media + "/" + Media + Ext_Media
|
||||
PathToDir='../BIN/'+ Emu_Media + '/'
|
||||
|
||||
|
||||
|
||||
if Emu_Media == "BIOS":
|
||||
url = "http://media.pyrharckade.io/"+ Emu_Media + "/" + Liste_media + "/" + Media + Ext_Media
|
||||
PathToDir='../MEDIA/BIOS/ROMS/'
|
||||
|
||||
text1 = "Check : " + Emu_Media_url + "/" + Liste_media + "/" + Media + Ext_Media
|
||||
text2 = font.render(text1, True, pygame.Color("white"), pygame.Color("black"))
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
|
||||
if not os.path.exists(PathToDir + Media + Ext_Media):
|
||||
try:
|
||||
urllib2.urlopen(url)
|
||||
ERR_TEST='OK'
|
||||
except urllib2.HTTPError, e:
|
||||
ERR_TEST=str(e.code)
|
||||
else:
|
||||
ERR_TEST = '404'
|
||||
u = urllib2.urlopen(url)
|
||||
meta = u.info()
|
||||
file_size = int(meta.getheaders("Content-Length")[0])
|
||||
file_size_exist=getSize(PathToDir + Media + Ext_Media)
|
||||
if str(file_size) == str(file_size_exist):
|
||||
ERR_TEST = '404'
|
||||
text1 = "Check : " + Emu_Media + "/" + Media + Ext_Media + " : OK"
|
||||
text2 = font.render(text1, True, pygame.Color("white"), pygame.Color("black"))
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
pygame.draw.rect(PyrScreen,(120,38,38),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
pygame.display.update()
|
||||
time.sleep(0.8)
|
||||
|
||||
|
||||
|
||||
else:
|
||||
ERR_TEST = 'GO_TO_DL'
|
||||
print "File Diff"
|
||||
|
||||
|
||||
|
||||
if ERR_TEST != '404':
|
||||
continuer = 1
|
||||
if not os.path.exists(PathToDir):
|
||||
os.makedirs(PathToDir)
|
||||
u = urllib2.urlopen(url)
|
||||
|
||||
meta = u.info()
|
||||
file_size = int(meta.getheaders("Content-Length")[0])
|
||||
|
||||
file_name = url.split('/')[-1]
|
||||
|
||||
f = open(PathToDir + file_name, 'wb')
|
||||
meta = u.info()
|
||||
file_size_dl = 0
|
||||
block_sz = 8192
|
||||
buffer=0
|
||||
#entry_info = 'Download ' + Type_Media + " in " + Emu_Media + " for " + Media
|
||||
|
||||
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
while finished == 0:
|
||||
if file_size_dl == file_size:
|
||||
text2 = font.render(entry_info, True, pygame.Color("green"),pygame.Color("black"))
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
# pygame.display.update()
|
||||
time.sleep(0.8)
|
||||
break
|
||||
finished=1
|
||||
buffer = u.read(block_sz)
|
||||
|
||||
file_size_dl += len(buffer)
|
||||
f.write(buffer)
|
||||
status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
|
||||
status = status + chr(8)*(len(status)+1)
|
||||
Progress=((XBAR*file_size_dl)/file_size)
|
||||
pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
pygame.draw.rect(PyrScreen,(120,38,38),((WHERE_XBAR,WHERE_YBAR),(Progress,YBAR)),0)
|
||||
Pourcent=100*file_size_dl/file_size
|
||||
|
||||
# pygame.display.update()
|
||||
|
||||
entry_info = 'Download ' + Emu_Media + " for " + Media + " : " + str(Pourcent) + " %"
|
||||
|
||||
text1 = entry_info
|
||||
text2 = font.render(entry_info, True, pygame.Color("white"), pygame.Color("black"))
|
||||
|
||||
pygame.time.delay(40)
|
||||
|
||||
# pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
#PyrScreen.blit(fond, (0,0))
|
||||
# pygame.display.update()
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
pygame.display.update()
|
||||
|
||||
else:
|
||||
print PathToDir + "/" + Media + Ext_Media + ' : OK'
|
||||
f.close()
|
||||
#pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
# pygame.display.update()
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
else:
|
||||
for Type_Media in (Liste_media):
|
||||
#for Type_Media in ('SNAP','WHEEL','DOCS','ROMS','VIDEO'):
|
||||
print(Type_Media)
|
||||
if Type_Media == "SNAP" or Type_Media == "WHEEL":
|
||||
Ext_Media=".png"
|
||||
if Type_Media == "VIDEO":
|
||||
Ext_Media=".mpg"
|
||||
if Type_Media == "ROMS":
|
||||
Ext_Media=".zip"
|
||||
if Type_Media == "DOCS":
|
||||
Ext_Media=".txt"
|
||||
if Emu_Media == "BIOS":
|
||||
Ext_Media=".tar.bz2"
|
||||
if Emu_Media == "NES" and Type_Media=="ROMS":
|
||||
Ext_Media=".nes"
|
||||
if Emu_Media == "GAMEBOY" and Type_Media=="ROMS":
|
||||
Ext_Media=".gb"
|
||||
|
||||
if Emu_Media == "FBA" or Emu_Media == "CPS3" or Emu_Media == "GNGEO" or Emu_Media == "MAME" or Emu_Media == "CPS3":
|
||||
Emu_Media_url = "ARCADE"
|
||||
else:
|
||||
Emu_Media_url=Emu_Media
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
text1 = "Check : " + Emu_Media_url + "/" + Type_Media+ "/" + Media + Ext_Media
|
||||
text2 = font.render(text1, True, pygame.Color("white"), pygame.Color("black"))
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
|
||||
|
||||
url = "http://media.pyrharckade.io/"+ Emu_Media_url + "/" + Type_Media+ "/" + Media + Ext_Media
|
||||
print(url)
|
||||
|
||||
file_name = url.split('/')[-1]
|
||||
|
||||
|
||||
if not os.path.exists('../MEDIA/' + Emu_Media + '/' + Type_Media + "/" + Media + Ext_Media):
|
||||
try:
|
||||
urllib2.urlopen(url)
|
||||
ERR_TEST='OK'
|
||||
except urllib2.HTTPError, e:
|
||||
ERR_TEST=str(e.code)
|
||||
else:
|
||||
ERR_TEST = '404'
|
||||
u = urllib2.urlopen(url)
|
||||
meta = u.info()
|
||||
file_size = int(meta.getheaders("Content-Length")[0])
|
||||
file_size_exist=getSize('../MEDIA/' + Emu_Media + '/' + Type_Media + "/" + Media + Ext_Media)
|
||||
if str(file_size) == str(file_size_exist):
|
||||
ERR_TEST = '404'
|
||||
text1 = "Check : " + Emu_Media_url + "/" + Type_Media+ "/" + Media + Ext_Media + " : OK"
|
||||
text2 = font.render(text1, True, pygame.Color("white"), pygame.Color("black"))
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
pygame.draw.rect(PyrScreen,(120,38,38),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
pygame.display.update()
|
||||
time.sleep(0.8)
|
||||
|
||||
|
||||
|
||||
else:
|
||||
ERR_TEST = 'GO_TO_DL'
|
||||
print "File Diff"
|
||||
|
||||
|
||||
|
||||
if ERR_TEST != '404':
|
||||
continuer = 1
|
||||
if not os.path.exists('../MEDIA/' + Emu_Media + '/' + Type_Media):
|
||||
os.makedirs('../MEDIA/' + Emu_Media + '/' + Type_Media)
|
||||
u = urllib2.urlopen(url)
|
||||
|
||||
meta = u.info()
|
||||
file_size = int(meta.getheaders("Content-Length")[0])
|
||||
|
||||
f = open('../MEDIA/' + Emu_Media + '/' + Type_Media + '/' + file_name, 'wb')
|
||||
meta = u.info()
|
||||
file_size_dl = 0
|
||||
block_sz = 8192
|
||||
buffer=0
|
||||
#entry_info = 'Download ' + Type_Media + " in " + Emu_Media + " for " + Media
|
||||
|
||||
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
while finished == 0:
|
||||
if file_size_dl == file_size:
|
||||
text2 = font.render(entry_info, True, pygame.Color("green"),pygame.Color("black"))
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
# pygame.display.update()
|
||||
time.sleep(0.8)
|
||||
break
|
||||
finished=1
|
||||
buffer = u.read(block_sz)
|
||||
|
||||
file_size_dl += len(buffer)
|
||||
f.write(buffer)
|
||||
status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
|
||||
status = status + chr(8)*(len(status)+1)
|
||||
Progress=((XBAR*file_size_dl)/file_size)
|
||||
pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
pygame.draw.rect(PyrScreen,(120,38,38),((WHERE_XBAR,WHERE_YBAR),(Progress,YBAR)),0)
|
||||
Pourcent=100*file_size_dl/file_size
|
||||
|
||||
# pygame.display.update()
|
||||
|
||||
entry_info = 'Download ' + Type_Media + " in " + Emu_Media + " for " + Media + " : " + str(Pourcent) + " %"
|
||||
|
||||
text1 = entry_info
|
||||
text2 = font.render(entry_info, True, pygame.Color("white"), pygame.Color("black"))
|
||||
|
||||
pygame.time.delay(40)
|
||||
|
||||
# pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
#PyrScreen.blit(fond, (0,0))
|
||||
# pygame.display.update()
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
pygame.display.update()
|
||||
|
||||
else:
|
||||
print '../MEDIA/' + Emu_Media + '/' + Type_Media + "/" + Media + Ext_Media + ' : OK'
|
||||
f.close()
|
||||
#pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
# pygame.display.update()
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
27
BIN/get_BIOS.sh
Executable file
@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ../
|
||||
WIM=`pwd`
|
||||
echo $WIM
|
||||
|
||||
if [[ ! -d "${WIM}/MEDIA/BIOS/" ]]; then mkdir -p ${WIM}/MEDIA/BIOS/ROMS/;fi
|
||||
|
||||
cd ${WIM}/BIN
|
||||
./download_graphical.py BIOS ROMS BIOS
|
||||
|
||||
|
||||
|
||||
cd ${WIM}/MEDIA/BIOS/ROMS/
|
||||
tar -jxf BIOS.tar.bz2
|
||||
for EMU in `cat ${WIM}/ROM_CONFIG_FILES.csv | cut -d"," -f2 | sort -u| grep -E "FBA|MAME|CPS3|GNGEO"`
|
||||
do
|
||||
echo "------------------------ $EMU ------------------------"
|
||||
for bios_file in `find ${WIM}/MEDIA/BIOS/ROMS/ | grep "\.zip"`
|
||||
do
|
||||
bios=`basename $bios_file`
|
||||
if [[ ! -d "${WIM}/MEDIA/${EMU}/ROMS/" ]] ;then mkdir -p ${WIM}/MEDIA/${EMU}/ROMS/ ;fi
|
||||
if [[ -f ${WIM}/MEDIA/${EMU}/ROMS/${bios} ]];then rm -f ${WIM}/MEDIA/${EMU}/ROMS/${bios} ;fi
|
||||
ln -s ${WIM}/MEDIA/BIOS/ROMS/${bios} ${WIM}/MEDIA/${EMU}/ROMS/${bios}
|
||||
done
|
||||
|
||||
done
|
||||
23
BIN/get_libretro_rpi_2_3.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd ../
|
||||
WIM=`pwd`
|
||||
echo $WIM
|
||||
|
||||
if [[ ! -d "${WIM}/BIN/LIBRETRO" ]]; then mkdir -p ${WIM}/BIN/LIBRETRO/;fi
|
||||
|
||||
cd ${WIM}/BIN
|
||||
|
||||
|
||||
for var in `cat ../ROM_CONFIG_FILES.csv| cut -d',' -f2| sort -u| grep -v SYS$`
|
||||
do
|
||||
./download_graphical.py LIBRETRO $var
|
||||
done
|
||||
./download_graphical.py LIBRETRO retroarch
|
||||
./download_graphical.py LIBRETRO config_libretro
|
||||
|
||||
mv ${WIM}/BIN/LIBRETRO/config_libretro.cfg ${WIM}/BIN/LIBRETRO/retroarch.cfg
|
||||
chmod +x ${WIM}/BIN/LIBRETRO/retroarch
|
||||
|
||||
|
||||
|
||||
255
BIN/get_media.sh
Executable file
@ -0,0 +1,255 @@
|
||||
#!/bin/bash
|
||||
|
||||
ROM_ARG=$1
|
||||
|
||||
usage() {
|
||||
|
||||
echo "$0 : Recupere les medias de type information / snapshoot / wheel selon votre fichier ROM_CONFIG_FILES.csv"
|
||||
echo " Recupere aussi les ROMS MAME / FBA / GNGEO si elles existent sur le serveur"
|
||||
echo ""
|
||||
echo "OPTION : "
|
||||
echo " $0 --> recupere tout les medias"
|
||||
echo " $0 \"[rom],[EMU]\" --> recupere tout les medias d'une rom particuliere en mode FORCE (ecrase l'existant)"
|
||||
exit
|
||||
|
||||
}
|
||||
|
||||
test_arg() {
|
||||
EMU=`echo $ROM_ARG | cut -d"," -f2`
|
||||
ROM=`echo $ROM_ARG | cut -d"," -f1`
|
||||
|
||||
if [[ -z $EMU ]] || [[ -z $ROM ]] || [[ -z `echo $ROM_ARG | grep ","` ]]
|
||||
then
|
||||
usage
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
TEST_REP() {
|
||||
|
||||
if [[ ! -z $ROM_ARG ]]
|
||||
then
|
||||
for REP in WHEEL SNAP VIDEO ROMS DOCS
|
||||
do
|
||||
if [[ ! -d ../MEDIA/${EMU}/$REP ]]
|
||||
then
|
||||
echo "Creation rep IMG de ${EMU} : ../MEDIA/${EMU}/${REP}"
|
||||
mkdir -p ../MEDIA/${EMU}/${REP}
|
||||
fi
|
||||
done
|
||||
else
|
||||
|
||||
for EMU_DIR in `cat ../ROM_CONFIG_FILES.csv | cut -d"," -f2 | sort -u`
|
||||
do
|
||||
for REP in WHEEL SNAP VIDEO ROMS DOCS
|
||||
do
|
||||
if [[ ! -d ../MEDIA/${EMU_DIR}/$REP ]]
|
||||
then
|
||||
echo "Creation rep IMG de ${EMU_DIR} : ../MEDIA/${EMU_DIR}/${REP}"
|
||||
mkdir -p ../MEDIA/${EMU_DIR}/${REP}
|
||||
fi
|
||||
done
|
||||
|
||||
done
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
get_docs() {
|
||||
if [[ "${EMU}" == "MAME" ]] || [[ "${EMU}" == "FBA" ]] || [[ "${EMU}" == "GNGEO" ]]
|
||||
then
|
||||
EMU_DL=ARCADE
|
||||
else
|
||||
EMU_DL=$EMU
|
||||
|
||||
fi
|
||||
wget -c -q -nv "http://media.pyrharckade.io/${EMU_DL}/DOCS/${ROM}.txt" -O ../MEDIA/${EMU}/DOCS/${ROM}.txt
|
||||
RES=$?
|
||||
if [[ "$RES" != "0" ]]
|
||||
then
|
||||
rm -f ../MEDIA/${EMU}/DOCS/${ROM}.txt
|
||||
echo -e " -> DOCS \033[31m FAILED \033[0m"
|
||||
else
|
||||
echo -e " -> DOCS \033[32m SUCCESS \033[0m"
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
get_snap() {
|
||||
if [[ "${EMU}" == "MAME" ]] || [[ "${EMU}" == "FBA" ]] || [[ "${EMU}" == "GNGEO" ]]
|
||||
then
|
||||
EMU_DL=ARCADE
|
||||
else
|
||||
EMU_DL=$EMU
|
||||
|
||||
fi
|
||||
wget -c -q -nv "http://media.pyrharckade.io/${EMU_DL}/SNAP/${ROM}.png" -O ../MEDIA/${EMU}/SNAP/${ROM}.png
|
||||
RES=$?
|
||||
if [[ "$RES" != "0" ]]
|
||||
then
|
||||
rm -f ../MEDIA/${EMU}/SNAP/${ROM}.png
|
||||
echo -e " -> SNAP \033[31m FAILED \033[0m"
|
||||
else
|
||||
echo -e " -> SNAP \033[32m SUCCESS \033[0m"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
get_wheel() {
|
||||
if [[ "${EMU}" == "MAME" ]] || [[ "${EMU_DL}" == "FBA" ]] || [[ "${EMU}" == "GNGEO" ]]
|
||||
then
|
||||
EMU_DL=ARCADE
|
||||
else
|
||||
EMU_DL=$EMU
|
||||
|
||||
fi
|
||||
|
||||
wget -c -q -nv "http://media.pyrharckade.io/${EMU}/WHEEL/${ROM}.png" -O ../MEDIA/${EMU}/WHEEL/${ROM}.png
|
||||
RES=$?
|
||||
if [[ "$RES" != "0" ]]
|
||||
then
|
||||
rm -f ../MEDIA/${EMU}/WHEEL/${ROM}.png
|
||||
echo -e " -> WHEEL \033[31m FAILED \033[0m"
|
||||
else
|
||||
echo -e " -> WHEEL \033[32m SUCCESS \033[0m"
|
||||
fi
|
||||
|
||||
}
|
||||
get_video() {
|
||||
if [[ "${ROM}" == 001_* ]]
|
||||
then
|
||||
echo -e " -> VIDEO \033[30m NA \033[0m"
|
||||
|
||||
else
|
||||
|
||||
if [[ "${EMU}" == "MAME" ]] || [[ "${EMU}" == "FBA" ]] || [[ "${EMU}" == "GNGEO" ]]
|
||||
then
|
||||
EMU_DL=ARCADE
|
||||
else
|
||||
EMU_DL=$EMU
|
||||
fi
|
||||
wget -c -q -nv "http://media.pyrharckade.io/${EMU_DL}/VIDEO/${ROM}.mpg" -O ../MEDIA/${EMU}/VIDEO/${ROM}.mpg
|
||||
RES=$?
|
||||
if [[ "$RES" != "0" ]]
|
||||
then
|
||||
rm -f ../MEDIA/${EMU}/VIDEO/${ROM}.mpg
|
||||
echo -e " -> VIDEO \033[31m FAILED \033[0m"
|
||||
else
|
||||
echo -e " -> VIDEO \033[32m SUCCESS \033[0m"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
get_bios() {
|
||||
echo "CHECK BIOS FILES"
|
||||
if [[ -f ~/pyrharckade/MEDIA/BIOS/bios_pack ]]
|
||||
then
|
||||
echo -e " -> BIOS PACK \033[32m SUCCESS \033[0m"
|
||||
else
|
||||
mkdir ~/pyrharckade/MEDIA/BIOS/
|
||||
wget -c -q -nv "http://media.pyrharckade.io/BIOS/bios_pack.zip" -O ~/pyrharckade/MEDIA/BIOS/bios_pack.zip
|
||||
cd ~/pyrharckade/MEDIA/BIOS/
|
||||
unzip -e bios_pack.zip > /dev/null
|
||||
for EMU in `cat ~/pyrharckade/ROM_CONFIG_FILES.csv|cut -d',' -f2|sort -u| grep -E "MAME|FBA|GNGEO"`
|
||||
do
|
||||
for bios in `ls -1| grep zip$| grep -v bios_pack.zip`
|
||||
do
|
||||
ln -s ~/pyrharckade/MEDIA/BIOS/$bios ~/pyrharckade/MEDIA/${EMU}/ROMS/$bios
|
||||
done
|
||||
done
|
||||
touch bios_pack
|
||||
cd -
|
||||
echo -e " -> BIOS PACK \033[32m SUCCESS \033[0m"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
get_roms() {
|
||||
|
||||
if [[ "${ROM}" == 001_* ]]
|
||||
then
|
||||
echo -e " -> VIDEO \033[30m NA \033[0m"
|
||||
|
||||
else
|
||||
EMU_URL=$EMU
|
||||
|
||||
if [[ "${EMU}" == "MAME" ]] || [[ "${EMU}" == "FBA" ]] || [[ "${EMU}" == "GNGEO" ]]
|
||||
then
|
||||
EMU_URL=ARCADE
|
||||
EXT_ROM=".zip"
|
||||
fi
|
||||
if [[ "${EMU}" == "GAMEBOY" ]]
|
||||
then
|
||||
EXT_ROM=".gb"
|
||||
fi
|
||||
if [[ "${EMU}" == "N64" ]]
|
||||
then
|
||||
EXT_ROM=".z64"
|
||||
fi
|
||||
if [[ "${EMU}" == "NES" ]]
|
||||
then
|
||||
EXT_ROM=".nes"
|
||||
fi
|
||||
|
||||
|
||||
|
||||
wget -c -q -nv "http://media.pyrharckade.io/${EMU_URL}/ROMS/${ROM}${EXT_ROM}" -O ../MEDIA/${EMU}/ROMS/${ROM}${EXT_ROM}
|
||||
RES=$?
|
||||
if [[ "$RES" != "0" ]]
|
||||
then
|
||||
rm -f ../MEDIA/${EMU}/ROMS/${ROM}${EXT_ROM}
|
||||
echo -e " -> ROMS ${EMU} \033[31m FAILED \033[0m"
|
||||
else
|
||||
echo -e " -> ROMS ${EMU} \033[32m SUCCESS \033[0m"
|
||||
fi
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [[ -z $ROM_ARG ]]
|
||||
then
|
||||
TEST_REP
|
||||
fi
|
||||
|
||||
|
||||
if [[ ! -z $ROM_ARG ]]
|
||||
then
|
||||
test_arg
|
||||
TEST_REP
|
||||
get_snap
|
||||
get_wheel
|
||||
get_video
|
||||
get_docs
|
||||
get_roms
|
||||
get_bios
|
||||
exit 0
|
||||
fi
|
||||
|
||||
export DISPLAY=0:0
|
||||
python ../CONF/download.py &
|
||||
|
||||
while read line
|
||||
do
|
||||
if [[ ! -z `echo $line | grep ','` ]]
|
||||
then
|
||||
echo $line | while IFS=',' read ROM EMU
|
||||
do
|
||||
echo -e "----- \033[36m $ROM \033[0m -----"
|
||||
get_snap
|
||||
get_wheel
|
||||
get_video
|
||||
get_docs
|
||||
get_roms
|
||||
done
|
||||
fi
|
||||
done < ../ROM_CONFIG_FILES.csv
|
||||
get_bios
|
||||
sudo killall -9 python
|
||||
20
BIN/get_media_graphical.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
ROM=$2
|
||||
EMU=$1
|
||||
|
||||
if [[ ! -z "$ROM" ]] && [[ ! -z "$EMU" ]]
|
||||
then
|
||||
cd BIN/
|
||||
./download_graphical.py $EMU $ROM
|
||||
else
|
||||
for RomConfigLine in `cat ../ROM_CONFIG_FILES.csv | sort | grep ','`
|
||||
do
|
||||
EMU=`echo $RomConfigLine| cut -d"," -f2`
|
||||
ROM=`echo $RomConfigLine| cut -d"," -f1`
|
||||
if [[ $EMU != "SYS" ]]
|
||||
then
|
||||
./download_graphical.py $EMU $ROM
|
||||
fi
|
||||
done
|
||||
fi
|
||||
50
CONF/ConfAllPath.py
Normal file
@ -0,0 +1,50 @@
|
||||
|
||||
def DefConfPathHome():
|
||||
import os
|
||||
#os.path.abspath(os.curdir)
|
||||
ParentOfPyr=os.path.abspath(os.curdir)
|
||||
#ParentOfPyr=(os.environ['HOME'] + "/pyrharckade_2")
|
||||
ConfRomFile=(ParentOfPyr + "/ROM_CONFIG_FILES.csv")
|
||||
AllMedia=(ParentOfPyr + "/MEDIA/")
|
||||
ConfigKeyboardFile=ParentOfPyr + "/CONF/KeyMapKeyBoard.py"
|
||||
return ParentOfPyr,ConfRomFile,AllMedia,ConfigKeyboardFile
|
||||
|
||||
|
||||
def DefConfPathEmu(Orientation):
|
||||
import os
|
||||
|
||||
ParentOfPyr=os.path.abspath(os.curdir)
|
||||
#ParentOfPyr=(os.environ['HOME'] + "/pyrharckade_2")
|
||||
Img=(ParentOfPyr + "/MEDIA/IMG/")
|
||||
BACKGROUNG=(ParentOfPyr + "/MEDIA/IMG/IMGY/SYS.png")
|
||||
if Orientation == "Y":
|
||||
BACKGROUNG_EMU=(ParentOfPyr + "/MEDIA/IMG/menu_Y.png")
|
||||
else:
|
||||
BACKGROUNG_EMU=(ParentOfPyr + "/MEDIA/IMG/menu_X.png")
|
||||
IMG_EMU = (ParentOfPyr + "/MEDIA/IMG/EMU/")
|
||||
BACKGROUNG_START=(ParentOfPyr + "/MEDIA/IMG/dpfe_welcom_X.png")
|
||||
BlackImg = (ParentOfPyr + "/MEDIA/IMG/black.png")
|
||||
SLEEP_BEFORE_START = 4
|
||||
if Orientation == "Y":
|
||||
BACKGROUNG_ORIG=(ParentOfPyr + "/MEDIA/IMG/IMGY/bg2_Y.png")
|
||||
else:
|
||||
BACKGROUNG_ORIG=(ParentOfPyr + "/MEDIA/IMG/IMGY/bg2_X.png")
|
||||
return Img,BACKGROUNG_ORIG,BACKGROUNG,IMG_EMU,BACKGROUNG_EMU
|
||||
|
||||
def DefConfPathGame(Orientation):
|
||||
import os
|
||||
ParentOfPyr=os.path.abspath(os.curdir)
|
||||
#ParentOfPyr=(os.environ['HOME'] + "/pyrharckade_2")
|
||||
BinOfPyr=(ParentOfPyr + "/BIN/")
|
||||
Wheel=(ParentOfPyr + "/MEDIA/Wheel/")
|
||||
Snap=(ParentOfPyr + "/MEDIA/SNAP/")
|
||||
Sound=(ParentOfPyr + "/MEDIA/SOUND/")
|
||||
IMG_EMU = (ParentOfPyr + "/MEDIA/IMG/EMU/")
|
||||
Roms=(ParentOfPyr + "/MEDIA/ROMS/")
|
||||
Docs=(ParentOfPyr + "/MEDIA/DOCS/")
|
||||
ImgY=(ParentOfPyr + "/MEDIA/IMG/IMGY/")
|
||||
ImgX=(ParentOfPyr + "/MEDIA/IMG/IMGX/")
|
||||
Img=(ParentOfPyr + "/MEDIA/IMG/")
|
||||
BlackImg = (ParentOfPyr + "/MEDIA/IMG/black.png")
|
||||
return ParentOfPyr,BinOfPyr,Wheel,Snap,Sound,Roms,Docs,ImgY,ImgX,Img,BlackImg,IMG_EMU
|
||||
|
||||
6
CONF/DefCheckEnvFile.py
Normal file
@ -0,0 +1,6 @@
|
||||
import os
|
||||
|
||||
def DefCheckEnv ():
|
||||
|
||||
Sys=os.uname()
|
||||
return Sys
|
||||
242
CONF/DefDownladPerGame.py
Normal file
@ -0,0 +1,242 @@
|
||||
#!/usr/bin/env python
|
||||
#-*- coding: utf-8 -*-
|
||||
# pyrharckade 2 is a simple pygame front for PIMAME
|
||||
# version: 2.0A
|
||||
# guillaume@tuxme.net
|
||||
# GPL Licence
|
||||
|
||||
import os, sys, pygame, pygame.font, pygame.image,subprocess, sys, time
|
||||
from pygame.locals import *
|
||||
import urllib2
|
||||
import urllib
|
||||
from DefResAndSysFile import *
|
||||
from DefCheckEnvFile import DefCheckEnv
|
||||
Sys=DefSystem()
|
||||
import glob
|
||||
Resolution=DefResolution()
|
||||
|
||||
|
||||
def DownloadGraphical(Emu_Media,Media):
|
||||
|
||||
def getSize(filename):
|
||||
st = os.stat(filename)
|
||||
return st.st_size
|
||||
|
||||
finished = 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if Emu_Media == "BIOS":
|
||||
Ext_Media=".tar.bz2"
|
||||
|
||||
if Emu_Media == "FBA" or Emu_Media == "CPS3" or Emu_Media == "GNGEO" or Emu_Media == "MAME" or Emu_Media == "CPS3":
|
||||
Emu_Media_url = "ARCADE"
|
||||
else:
|
||||
Emu_Media_url=Emu_Media
|
||||
|
||||
|
||||
### PROD
|
||||
pygame.init()
|
||||
Y,X=Resolution
|
||||
PyrScreen = pygame.display.set_mode(Resolution,FULLSCREEN)
|
||||
|
||||
### TEST
|
||||
#Y,X=(800,600)
|
||||
#Resolution=(Y,X)
|
||||
#PyrScreen = pygame.display.set_mode(Resolution)
|
||||
|
||||
|
||||
|
||||
|
||||
Space_bar=20
|
||||
XBAR=(Y-(Y/Space_bar))
|
||||
YBAR=(X/10)
|
||||
WHERE_XBAR=Space_bar
|
||||
WHERE_YBAR=(Y/2) - (YBAR/2)
|
||||
|
||||
|
||||
if glob.glob("./BIN/download.png"):
|
||||
IMG_DL="./BIN/download.png"
|
||||
FONT_DL="./MEDIA/font.ttf"
|
||||
PATH_MEDIA="./MEDIA/"
|
||||
else:
|
||||
IMG_DL="download.png"
|
||||
FONT_DL="../MEDIA/font.ttf"
|
||||
PATH_MEDIA="../MEDIA/"
|
||||
|
||||
fond = pygame.transform.scale(pygame.image.load(IMG_DL).convert(),Resolution)
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
time.sleep(0.8)
|
||||
pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
FontSize = (X/10)
|
||||
font = pygame.font.Font(FONT_DL, (FontSize+10))
|
||||
|
||||
|
||||
|
||||
|
||||
if Sys == "Darwin":
|
||||
Liste_media='SNAP','WHEEL','DOCS','ROMS'
|
||||
else :
|
||||
Liste_media='SNAP','WHEEL','DOCS','ROMS','VIDEO'
|
||||
print("SYSTEM : " + (Sys))
|
||||
|
||||
for Type_Media in (Liste_media):
|
||||
#for Type_Media in ('SNAP','WHEEL','DOCS'):
|
||||
|
||||
|
||||
|
||||
if Type_Media == "SNAP" or Type_Media == "WHEEL":
|
||||
Ext_Media=".png"
|
||||
if Type_Media == "VIDEO":
|
||||
Ext_Media=".mpg"
|
||||
if Type_Media == "ROMS":
|
||||
Ext_Media=".zip"
|
||||
if Type_Media == "DOCS":
|
||||
Ext_Media=".txt"
|
||||
if Emu_Media == "BIOS":
|
||||
Ext_Media=".tar.bz2"
|
||||
if Emu_Media == "NES" and Type_Media=="ROMS":
|
||||
Ext_Media=".nes"
|
||||
if Emu_Media == "GAMEBOY" and Type_Media=="ROMS":
|
||||
Ext_Media=".gb"
|
||||
|
||||
|
||||
|
||||
if Emu_Media == "FBA" or Emu_Media == "CPS3" or Emu_Media == "GNGEO" or Emu_Media == "MAME" or Emu_Media == "CPS3":
|
||||
Emu_Media_url = "ARCADE"
|
||||
else:
|
||||
Emu_Media_url=Emu_Media
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
text1 = "Check : " + Emu_Media_url + "/" + Type_Media+ "/" + Media + Ext_Media
|
||||
text2 = font.render(text1, True, pygame.Color("white"), pygame.Color("black"))
|
||||
#PyrScreen.blit(text2,((Y/2),(Y/2)))
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
|
||||
url = "http://media.pyrharckade.io/"+ Emu_Media_url + "/" + Type_Media+ "/" + Media + Ext_Media
|
||||
|
||||
if Type_Media == "ROMS" and Emu_Media_url == "ARCADE":
|
||||
Ext_Media=".zip"
|
||||
url = "http://www.arcadehits.net/downloads/tool.php?am=berzerking&Fichier=mame/" + Media + Ext_Media
|
||||
|
||||
|
||||
|
||||
|
||||
if Emu_Media == "SYS" and Type_Media=="ROMS":
|
||||
Ext_media=".csv"
|
||||
url="http://media.pyrharckade.io/SYS/ROMS/ROM_CONFIG_FILES.csv"
|
||||
print(url)
|
||||
|
||||
file_name = url.split('/')[-1]
|
||||
print ( PATH_MEDIA + Emu_Media + '/' + Type_Media + "/" + Media + Ext_Media)
|
||||
|
||||
if not os.path.exists(PATH_MEDIA + Emu_Media + '/' + Type_Media + "/" + Media + Ext_Media):
|
||||
TestCodeUrl=urllib.urlopen(url).getcode()
|
||||
if TestCodeUrl == 200:
|
||||
#try:
|
||||
# urllib2.urlopen(url)
|
||||
ERR_TEST='OK'
|
||||
#except urllib2.HTTPError, e:
|
||||
# ERR_TEST=str(e.code)
|
||||
else:
|
||||
ERR_TEST='404'
|
||||
|
||||
|
||||
else:
|
||||
ERR_TEST = '404'
|
||||
print (PATH_MEDIA + Emu_Media + '/' + Type_Media + "/" + Media + Ext_Media)
|
||||
u = urllib2.urlopen(url)
|
||||
meta = u.info()
|
||||
file_size = int(meta.getheaders("Content-Length")[0])
|
||||
file_size_exist=getSize(PATH_MEDIA + Emu_Media + '/' + Type_Media + "/" + Media + Ext_Media)
|
||||
if str(file_size) == str(file_size_exist):
|
||||
ERR_TEST = '404'
|
||||
text1 = "Check : " + Emu_Media_url + "/" + Type_Media+ "/" + Media + Ext_Media + " : OK"
|
||||
text2 = font.render(text1, True, pygame.Color("white"), pygame.Color("black"))
|
||||
#PyrScreen.blit(text2,(Space_bar,WHERE_YBAR+(YBAR*2)))
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
pygame.draw.rect(PyrScreen,(120,38,38),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
pygame.display.update()
|
||||
time.sleep(0.8)
|
||||
|
||||
else:
|
||||
ERR_TEST = 'GO_TO_DL'
|
||||
print ("File Diff")
|
||||
|
||||
if ERR_TEST != '404':
|
||||
continuer = 1
|
||||
if not os.path.exists(PATH_MEDIA + Emu_Media + '/' + Type_Media):
|
||||
os.makedirs(PATH_MEDIA + Emu_Media + '/' + Type_Media)
|
||||
u = urllib.urlopen(url)
|
||||
|
||||
meta = u.info()
|
||||
file_size = int(meta.getheaders("Content-Length")[0])
|
||||
|
||||
f = open(PATH_MEDIA + Emu_Media + '/' + Type_Media + '/' + file_name, 'wb')
|
||||
meta = u.info()
|
||||
file_size_dl = 0
|
||||
block_sz = 8192
|
||||
buffer=0
|
||||
#entry_info = 'Download ' + Type_Media + " in " + Emu_Media + " for " + Media
|
||||
|
||||
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
while finished == 0:
|
||||
if file_size_dl == file_size:
|
||||
text2 = font.render(entry_info, True, pygame.Color("green"),pygame.Color("black"))
|
||||
#PyrScreen.blit(text2,(Space_bar,WHERE_YBAR+(YBAR*2)))
|
||||
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
# pygame.display.update()
|
||||
time.sleep(0.8)
|
||||
break
|
||||
finished=1
|
||||
buffer = u.read(block_sz)
|
||||
|
||||
file_size_dl += len(buffer)
|
||||
f.write(buffer)
|
||||
status = r"%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size)
|
||||
status = status + chr(8)*(len(status)+1)
|
||||
Progress=((XBAR*file_size_dl)/file_size)
|
||||
pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
pygame.draw.rect(PyrScreen,(120,38,38),((WHERE_XBAR,WHERE_YBAR),(Progress,YBAR)),0)
|
||||
Pourcent=100*file_size_dl/file_size
|
||||
|
||||
# pygame.display.update()
|
||||
|
||||
entry_info = 'Download ' + Type_Media + " in " + Emu_Media + " for " + Media + " : " + str(Pourcent) + " %"
|
||||
|
||||
text1 = entry_info
|
||||
text2 = font.render(entry_info, True, pygame.Color("white"), pygame.Color("black"))
|
||||
|
||||
pygame.time.delay(40)
|
||||
|
||||
# pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
#PyrScreen.blit(fond, (0,0))
|
||||
# pygame.display.update()
|
||||
#PyrScreen.blit(text2,(Space_bar,WHERE_YBAR+(YBAR*2)))
|
||||
PyrScreen.blit(text2,((Space_bar),(X/2)))
|
||||
pygame.display.update()
|
||||
|
||||
else:
|
||||
print ( PATH_MEDIA + Emu_Media + '/' + Type_Media + "/" + Media + Ext_Media + ' : OK')
|
||||
f.close()
|
||||
#pygame.draw.rect(PyrScreen,(200,200,200),((WHERE_XBAR,WHERE_YBAR),(XBAR,YBAR)),0)
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
# pygame.display.update()
|
||||
pygame.display.update()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
155
CONF/DefFrontEndEmuFile.py
Normal file
@ -0,0 +1,155 @@
|
||||
import pygame
|
||||
import sys
|
||||
|
||||
from pygame.locals import *
|
||||
from DefFrontEndGameMapFile import *
|
||||
from DefFrontEndEmuFile import *
|
||||
from ConfAllPath import *
|
||||
|
||||
|
||||
import os
|
||||
from ConfAllPath import *
|
||||
from KeyMapKeyBoard import *
|
||||
|
||||
def DefFrontEndEmu(Resolution,emu,MapingEmu,li,CptEmu,MAX_EMU,MAX,Orientation,JOY_TEST):
|
||||
|
||||
#one_debug = 0
|
||||
MAX_EMU = MAX_EMU -1
|
||||
pygame.key.set_repeat(400, 50)
|
||||
Img,BACKGROUNG_ORIG,BACKGROUNG,IMG_EMU,BACKGROUNG_EMU=DefConfPathEmu(Orientation)
|
||||
SIZE_BIN_1,SIZE_BIN_2,SIZE_BIN_3,WHERE_BIN_1,WHERE_BIN_2,WHERE_BIN_3=MapingEmu
|
||||
Resolution=Resolution
|
||||
pygame.init()
|
||||
PyrScreen = pygame.display.set_mode(Resolution,FULLSCREEN)
|
||||
fond = pygame.transform.scale(pygame.image.load(BACKGROUNG_EMU).convert(),Resolution)
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
#pygame.joystick.init()
|
||||
if JOY_TEST == 1:
|
||||
mon_joystick = pygame.joystick.Joystick(0)
|
||||
mon_joystick.init
|
||||
if(CptEmu > MAX_EMU) or (CptEmu < - MAX_EMU):
|
||||
CptEmu = 0
|
||||
|
||||
if (CptEmu + 1) > MAX_EMU:
|
||||
CptRight = 0
|
||||
else:
|
||||
CptRight = CptEmu + 1
|
||||
|
||||
if (CptEmu - 1) < - MAX_EMU:
|
||||
CptLeft = 0
|
||||
else:
|
||||
CptLeft = CptEmu - 1
|
||||
|
||||
pygame.display.flip()
|
||||
KeepInEmu = 1
|
||||
FrontEndEmu = 1
|
||||
ExitStatus = 0
|
||||
while KeepInEmu == 1:
|
||||
BeepFile=Img + "../SOUND/blip.wav"
|
||||
BeepFileLoad=pygame.mixer.music.load(BeepFile)
|
||||
for event in pygame.event.get():
|
||||
if JOY_TEST == 0 :
|
||||
if event.type == KEYDOWN:
|
||||
# if event.key == K_LEFT:
|
||||
if event.key == LEFT_J1:
|
||||
CptEmu = CptEmu - 1
|
||||
# print "DEBUG : LEFT : " + str(LEFT_J1)
|
||||
# one_debug = 0
|
||||
# if event.key == K_RIGHT:
|
||||
if event.key == RIGHT_J1:
|
||||
CptEmu = CptEmu + 1
|
||||
# print "DEBUG : RIGHT : " + str(RIGHT_J1)
|
||||
# one_debug = 0
|
||||
if event.key == BTN_J1_1:
|
||||
FrontEndEmu = 0
|
||||
ExitStatus = 0
|
||||
KeepInEmu = 0
|
||||
FrontEndGame = 1
|
||||
EmuChoose = emu[CptEmu]
|
||||
#print "Play ... "
|
||||
if event.key == K_ESCAPE:
|
||||
FrontEndEmu = 0
|
||||
ExitStatus = 1
|
||||
FrontEndGame = 0
|
||||
EmuChoose = ""
|
||||
KeepInEmu=0
|
||||
pygame.mixer.Sound(BeepFile).play()
|
||||
if JOY_TEST == 1 :
|
||||
if event.type == JOYAXISMOTION:
|
||||
if event.axis == 0 and event.value > 0:
|
||||
CptEmu = CptEmu - 1
|
||||
if event.axis == 0 and event.value < 0:
|
||||
CptEmu = CptEmu + 1
|
||||
if event.type == JOYBUTTONDOWN and event.button == BTN_J1_1:
|
||||
FrontEndEmu = 0
|
||||
ExitStatus = 0
|
||||
KeepInEmu = 0
|
||||
FrontEndGame = 1
|
||||
EmuChoose = emu[CptEmu]
|
||||
pygame.mixer.Sound(BeepFile).play()
|
||||
|
||||
if (CptEmu > MAX_EMU) or (CptEmu < - MAX_EMU):
|
||||
CptEmu = 0
|
||||
|
||||
if (CptEmu + 1) > MAX_EMU:
|
||||
CptRight = 0
|
||||
else:
|
||||
CptRight = CptEmu + 1
|
||||
|
||||
if (CptEmu - 1) < - MAX_EMU:
|
||||
CptLeft = 0
|
||||
else:
|
||||
CptLeft = CptEmu - 1
|
||||
|
||||
#if one_debug == 0:
|
||||
# print "4. CptLeft -> " + str(CptLeft)
|
||||
|
||||
#if one_debug == 0:
|
||||
# print "2. CptEmu -> " + str(CptEmu)
|
||||
|
||||
#if one_debug == 0:
|
||||
# print "3. CptRight -> " + str(CptRight)
|
||||
|
||||
EmuRightPath=IMG_EMU+'/'+emu[CptRight]+ ".png"
|
||||
EmuLeftPath=IMG_EMU+'/'+emu[CptLeft]+ ".png"
|
||||
EmuCenterPath=IMG_EMU+'/'+emu[CptEmu]+ ".png"
|
||||
|
||||
#if one_debug == 0:
|
||||
# print "EmuLeftPath -> " + EmuLeftPath
|
||||
#if one_debug == 0:
|
||||
# print "EmuCenterPath -> " + EmuCenterPath
|
||||
#if one_debug == 0:
|
||||
# print "EmuRightPath -> " + EmuRightPath
|
||||
#if one_debug == 0:
|
||||
# print "5. " + str(CptEmu) + " : " + emu[CptEmu]
|
||||
#if one_debug == 0:
|
||||
# one_debug = 1;
|
||||
|
||||
if (os.path.isfile(IMG_EMU+'/'+emu[CptRight]+ ".png")):
|
||||
EmuRightPath=IMG_EMU+'/'+emu[CptRight]+ ".png"
|
||||
EmuRight=pygame.transform.scale(pygame.image.load(EmuRightPath).convert_alpha(),SIZE_BIN_3)
|
||||
else:
|
||||
muRightPath=IMG_EMU+'/no_emu.png'
|
||||
EmuRight=pygame.transform.scale(pygame.image.load(EmuRightPath).convert_alpha(),SIZE_BIN_3)
|
||||
|
||||
if (os.path.isfile(IMG_EMU+'/'+emu[CptLeft]+ ".png")):
|
||||
EmuLeftPath=IMG_EMU+'/'+emu[CptLeft]+ ".png"
|
||||
EmuLeft=pygame.transform.scale(pygame.image.load(EmuLeftPath).convert_alpha(),SIZE_BIN_2)
|
||||
else:
|
||||
EmuLeftPath=IMG_EMU+'/no_emu.png'
|
||||
EmuLeft=pygame.transform.scale(pygame.image.load(EmuLeftPath).convert_alpha(),SIZE_BIN_2)
|
||||
|
||||
if (os.path.isfile(IMG_EMU+'/'+emu[CptEmu]+ ".png")):
|
||||
EmuCenterPath=IMG_EMU+'/'+emu[CptEmu]+ ".png"
|
||||
EmuCenter=pygame.transform.scale(pygame.image.load(EmuCenterPath).convert_alpha(),SIZE_BIN_1)
|
||||
else:
|
||||
EmuCenterPath=IMG_EMU+'/no_emu.png'
|
||||
EmuCenter=pygame.transform.scale(pygame.image.load(EmuCenterPath).convert_alpha(),SIZE_BIN_1)
|
||||
|
||||
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
PyrScreen.blit(EmuRight,WHERE_BIN_2),SIZE_BIN_3
|
||||
PyrScreen.blit(EmuLeft,WHERE_BIN_3),SIZE_BIN_1
|
||||
PyrScreen.blit(EmuCenter,WHERE_BIN_1),SIZE_BIN_1
|
||||
pygame.display.flip()
|
||||
return FrontEndEmu,ExitStatus,FrontEndGame,EmuChoose,CptEmu
|
||||
80
CONF/DefFrontEndEmuMapFile.py
Normal file
@ -0,0 +1,80 @@
|
||||
from math import *
|
||||
|
||||
def DefFrontEndEmuMapX(resolution):
|
||||
SCREEN_W,SCREEN_H=resolution
|
||||
#print str(SCREEN_W) + "x" + str(SCREEN_H)
|
||||
## TAILLE DES MENU EMU
|
||||
|
||||
SIZE_BIN_X_1 = int(floor(SCREEN_W /4))
|
||||
SIZE_BIN_Y_1 = SIZE_BIN_X_1
|
||||
SIZE_BIN_1 = (SIZE_BIN_X_1,SIZE_BIN_Y_1)
|
||||
|
||||
SIZE_BIN_X_2 = int(floor(SIZE_BIN_X_1*2/3))
|
||||
SIZE_BIN_Y_2 = SIZE_BIN_X_2
|
||||
SIZE_BIN_2 = (SIZE_BIN_X_2,SIZE_BIN_Y_2)
|
||||
|
||||
SIZE_BIN_X_3 = SIZE_BIN_X_2
|
||||
SIZE_BIN_Y_3 = SIZE_BIN_X_3
|
||||
SIZE_BIN_3 = (SIZE_BIN_X_3,SIZE_BIN_Y_3)
|
||||
|
||||
##EMU CENTRE POSITION
|
||||
|
||||
WHERE_BIN_1_X=int(floor((SCREEN_W / 2)-(SIZE_BIN_X_1/2)))
|
||||
WHERE_BIN_1_Y=int(floor((SCREEN_H / 2) - (SIZE_BIN_X_1/2)))
|
||||
WHERE_BIN_1=(WHERE_BIN_1_X,WHERE_BIN_1_Y)
|
||||
|
||||
##EMU GAUCHE POSITION
|
||||
|
||||
WHERE_BIN_2_X=int(floor((SCREEN_W / 4)-(SIZE_BIN_X_2/2)))
|
||||
WHERE_BIN_2_Y=int(floor(SCREEN_H / 3))
|
||||
WHERE_BIN_2=(WHERE_BIN_2_X,WHERE_BIN_2_Y)
|
||||
|
||||
##EMU GAUCHE POSITION
|
||||
|
||||
WHERE_BIN_3_X=int(floor((SCREEN_W * 3 / 4)-(SIZE_BIN_X_3/2)))
|
||||
WHERE_BIN_3_Y=int(floor(SCREEN_H / 3))
|
||||
WHERE_BIN_3=(WHERE_BIN_3_X,WHERE_BIN_3_Y)
|
||||
|
||||
|
||||
return(SIZE_BIN_1,SIZE_BIN_2,SIZE_BIN_3,WHERE_BIN_1,WHERE_BIN_2,WHERE_BIN_3)
|
||||
|
||||
|
||||
|
||||
def DefFrontEndEmuMapY(resolution):
|
||||
SCREEN_W,SCREEN_H=resolution
|
||||
#print str(SCREEN_W) + "x" + str(SCREEN_H)
|
||||
SIZE_BIN_X_1 = int(floor(SCREEN_W /4))
|
||||
SIZE_BIN_Y_1 = SIZE_BIN_X_1
|
||||
SIZE_BIN_1 = (SIZE_BIN_X_1,SIZE_BIN_Y_1)
|
||||
|
||||
SIZE_BIN_X_2 = SIZE_BIN_X_1/2
|
||||
SIZE_BIN_Y_2 = SIZE_BIN_X_2
|
||||
SIZE_BIN_2 = (SIZE_BIN_X_2,SIZE_BIN_Y_2)
|
||||
|
||||
SIZE_BIN_X_3 = SIZE_BIN_X_2
|
||||
SIZE_BIN_Y_3 = SIZE_BIN_X_3
|
||||
SIZE_BIN_3 = (SIZE_BIN_X_3,SIZE_BIN_Y_3)
|
||||
|
||||
##EMU CENTRE POSITION
|
||||
|
||||
WHERE_BIN_1_X=int(floor((SCREEN_W / 2)-(SIZE_BIN_X_1/2)))
|
||||
WHERE_BIN_1_Y=int(floor((SCREEN_H / 2) - (SIZE_BIN_X_1/2)))
|
||||
WHERE_BIN_1=(WHERE_BIN_1_X,WHERE_BIN_1_Y)
|
||||
|
||||
##EMU GAUCHE POSITION
|
||||
|
||||
WHERE_BIN_2_X=WHERE_BIN_1_X+(SIZE_BIN_X_2/2)
|
||||
WHERE_BIN_2_Y=SCREEN_H/8
|
||||
WHERE_BIN_2=(WHERE_BIN_2_X,WHERE_BIN_2_Y)
|
||||
|
||||
##EMU GAUCHE POSITION
|
||||
|
||||
WHERE_BIN_3_X=WHERE_BIN_2_X
|
||||
WHERE_BIN_3_Y=SCREEN_H-SIZE_BIN_Y_3-SCREEN_H/8
|
||||
|
||||
WHERE_BIN_3=(WHERE_BIN_3_X,WHERE_BIN_3_Y)
|
||||
|
||||
|
||||
return(SIZE_BIN_1,SIZE_BIN_2,SIZE_BIN_3,WHERE_BIN_1,WHERE_BIN_2,WHERE_BIN_3)
|
||||
|
||||
|
||||
350
CONF/DefFrontEndGameFile.py
Normal file
@ -0,0 +1,350 @@
|
||||
import pygame
|
||||
import sys
|
||||
import time
|
||||
import subprocess
|
||||
import os
|
||||
from pygame.locals import *
|
||||
from pygame import *
|
||||
from pygame import movie
|
||||
#from pygame.movie import *
|
||||
from DefFrontEndEmuMapFile import *
|
||||
from DefFrontEndEmuFile import *
|
||||
from ConfAllPath import *
|
||||
from DefFrontEndGameMapFile import DefFrontEndGameMap
|
||||
from DefLaunchSomethingFile import DefLaunchSomething
|
||||
from DefDownladPerGame import DownloadGraphical
|
||||
from DefCheckEnvFile import DefCheckEnv
|
||||
from KeyMapKeyBoard import *
|
||||
from time import gmtime, strftime
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def DefFrontEndGame(EmuChoose,Resolution,emu,li,CptGame,MAX_EMU,MAX,CptEmu,GamePerEmu,MaxForThisEmu,Orientation,JOY_TEST):
|
||||
|
||||
Sys=DefCheckEnv()[0]
|
||||
pygame.key.set_repeat(400, 70)
|
||||
# Orientation='X'
|
||||
ParentOfPyr,ConfRomFile,AllMedia,ConfigKeyboardFile=DefConfPathHome()
|
||||
|
||||
|
||||
|
||||
font_path,font_size,max_carac,WHERE_TEXTE,WHERE_TEXTE_X,WHERE_TEXTE_Y,SIZE_TEXTE_W,SIZE_TEXTE_H,SIZE_TEXTE,WHERE_WHEEL,WHERE_SYS,SIZE_WHEEL_CONVERT,WHERE_SNAP,SIZE_SNAP_CONVERT,SIZE_SYS_CONVERT,UNIT_L,UNIT_H=DefFrontEndGameMap(Resolution,Orientation)
|
||||
font = pygame.font.Font(font_path, font_size)
|
||||
ParentOfPyr,BinOfPyr,Wheel,Snap,Sound,Roms,Docs,ImgY,ImgX,Img,BlackImg,IMG_EMU=DefConfPathGame(Orientation)
|
||||
BeepFileGame=ParentOfPyr + "/MEDIA/SOUND/blip.wav"
|
||||
MyBip=pygame.mixer.Sound(BeepFileGame)
|
||||
pygame.init()
|
||||
PyrScreen = pygame.display.set_mode(Resolution,FULLSCREEN)
|
||||
if Orientation=='Y':
|
||||
|
||||
### TODO
|
||||
if (os.path.isfile(ImgY + EmuChoose + ".png")):
|
||||
Background=Img + "/black.png"
|
||||
else:
|
||||
Background=Img + "/black.png"
|
||||
### ODOT
|
||||
else:
|
||||
if (os.path.isfile(ImgX + EmuChoose + ".png")):
|
||||
Background=ImgX + EmuChoose + ".png"
|
||||
else:
|
||||
Background=Img + "/menu_X.png"
|
||||
fond = pygame.transform.scale(pygame.image.load(Background).convert(),Resolution)
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
|
||||
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_SNAP_CONVERT)),WHERE_SNAP)
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_SYS_CONVERT)),WHERE_SYS)
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_WHEEL_CONVERT)),WHERE_WHEEL)
|
||||
|
||||
|
||||
GameSnapPath=AllMedia+EmuChoose+ "/SNAP/" + GamePerEmu[CptGame][0]+".png"
|
||||
GameWheelPath=AllMedia+EmuChoose+ "/WHEEL/" + GamePerEmu[CptGame][0]+".png"
|
||||
GameSysPath=AllMedia + "/IMG/EMU/LOGO/" + EmuChoose +".png"
|
||||
GameDocPath=AllMedia+EmuChoose+ "/DOCS/" + GamePerEmu[CptGame][0]+".txt"
|
||||
GameVideoPath=AllMedia+EmuChoose+ "/VIDEO/" + GamePerEmu[CptGame][0]+".mpg"
|
||||
|
||||
|
||||
|
||||
|
||||
if (os.path.isfile(GameSysPath)):
|
||||
GameSys=pygame.transform.scale(pygame.image.load(GameSysPath).convert_alpha(),SIZE_SYS_CONVERT)
|
||||
else:
|
||||
GameSysPath=AllMedia+"/no_sys.png"
|
||||
GameSys=pygame.transform.scale(pygame.image.load(GameSysPath).convert_alpha(),SIZE_SYS_CONVERT)
|
||||
|
||||
|
||||
|
||||
|
||||
if (os.path.isfile(GameSnapPath)):
|
||||
GameSnap=pygame.transform.scale(pygame.image.load(GameSnapPath).convert_alpha(),SIZE_SNAP_CONVERT)
|
||||
else:
|
||||
GameSnapPath=AllMedia+"/no_snap.png"
|
||||
GameSnap=pygame.transform.scale(pygame.image.load(GameSnapPath).convert_alpha(),SIZE_SNAP_CONVERT)
|
||||
|
||||
|
||||
if (os.path.isfile(GameWheelPath)):
|
||||
GameWheel=pygame.transform.scale(pygame.image.load(GameWheelPath).convert_alpha(),SIZE_WHEEL_CONVERT)
|
||||
else:
|
||||
GameWheelPath=AllMedia+"/no_wheel.png"
|
||||
GameWheel=pygame.transform.scale(pygame.image.load(GameWheelPath).convert_alpha(),SIZE_WHEEL_CONVERT)
|
||||
FILE_INFO=AllMedia+EmuChoose+ "/DOCS/" + GamePerEmu[CptGame][0]+".txt"
|
||||
if os.path.isfile(FILE_INFO):
|
||||
FILE_DOC = open(FILE_INFO,"r")
|
||||
text1 = FILE_DOC.read()
|
||||
LPLUS=0
|
||||
LPLUS=LPLUS + (font_size+3)
|
||||
WHERE_TEXTE=(WHERE_TEXTE_X,WHERE_TEXTE_Y)
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE)),(WHERE_TEXTE))
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE)),WHERE_TEXTE)
|
||||
for ligne in text1.splitlines():
|
||||
ligne=ligne[0:max_carac]
|
||||
x,y = PyrScreen.blit(font.render(ligne,10,pygame.Color("red")),(WHERE_TEXTE_X,WHERE_TEXTE_Y+LPLUS)).bottomleft
|
||||
LPLUS=LPLUS + (font_size+1)
|
||||
if ((WHERE_TEXTE_Y + LPLUS) > (SIZE_TEXTE_H*3 +(UNIT_H*2))):
|
||||
break
|
||||
FILE_DOC.close()
|
||||
else:
|
||||
text1 = "No DATA File : " #+ GamePerEmu[CptGame][MAX_EMU][0]
|
||||
text2 = font.render(text1, True, pygame.Color("red"))
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE_W,SIZE_TEXTE_H)),((WHERE_TEXTE_X,WHERE_TEXTE_Y)))
|
||||
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE)),WHERE_TEXTE)
|
||||
PyrScreen.blit(text2,(WHERE_TEXTE_X,WHERE_TEXTE_Y+50)).bottomleft
|
||||
|
||||
|
||||
|
||||
|
||||
PyrScreen.blit(GameSnap,WHERE_SNAP)
|
||||
PyrScreen.blit(GameSys,WHERE_SYS)
|
||||
PyrScreen.blit(GameWheel,WHERE_WHEEL)
|
||||
pygame.display.flip()
|
||||
|
||||
|
||||
KeepInGame = 1
|
||||
FrontEndGame = 1
|
||||
ExitStatus = 0
|
||||
T1=0
|
||||
while KeepInGame == 1:
|
||||
|
||||
for event in pygame.event.get():
|
||||
#T1=(time.time())
|
||||
T1=strftime("%H%M%S", gmtime())
|
||||
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE)),WHERE_TEXTE)
|
||||
if JOY_TEST == 1 :
|
||||
if event.type == JOYAXISMOTION:
|
||||
if event.axis == 0 and event.value > 0:
|
||||
CptGame = CptGame + 1
|
||||
if event.axis == 0 and event.value < 0:
|
||||
CptGame = CptGame - 1
|
||||
if event.axis == 1 and event.value < 0:
|
||||
ROM_L1 = GamePerEmu[CptGame][0][0]
|
||||
ROM_L2 = ROM_L1
|
||||
while (ROM_L1 == ROM_L2):
|
||||
CptGame = CptGame + 1
|
||||
if CptGame >= MaxForThisEmu:
|
||||
CptGame=0
|
||||
break
|
||||
ROM_L1 = GamePerEmu[CptGame][0][0]
|
||||
if event.axis == 1 and event.value > 0:
|
||||
ROM_L1 = GamePerEmu[CptGame][0][0]
|
||||
ROM_L2 = ROM_L1
|
||||
while (ROM_L1 == ROM_L2):
|
||||
CptGame = CptGame - 1
|
||||
if CptGame <= -MaxForThisEmu:
|
||||
CptGame=0
|
||||
break
|
||||
ROM_L1 = GamePerEmu[CptGame][0][0]
|
||||
if event.type == JOYBUTTONDOWN:
|
||||
if event.button == BTN_J1_2:
|
||||
FrontEndGame = 0
|
||||
ExitStatus = 0
|
||||
KeepInGame = 0
|
||||
FrontEndEmu = 1
|
||||
CptEmu = 0
|
||||
if event.button == BTN_J1_1:
|
||||
FrontEndGame = 0
|
||||
FrontEndGame = 1
|
||||
ExitStatus = 0
|
||||
KeepInGame= 1
|
||||
FrontEndEmu = 0
|
||||
GameChoose = GamePerEmu[CptGame][0]
|
||||
DefLaunchSomething(EmuChoose,GameChoose,AllMedia,font,Resolution,BlackImg,WHERE_TEXTE,SIZE_TEXTE,Background,Orientation)
|
||||
pygame.mixer.Sound(BeepFileGame).play()
|
||||
|
||||
if JOY_TEST == 0 :
|
||||
if event.type == KEYDOWN:
|
||||
if event.key == LEFT_J1:
|
||||
# if event.key == K_LEFT:
|
||||
CptGame = CptGame - 1
|
||||
# if event.key == K_RIGHT:
|
||||
if event.key == RIGHT_J1:
|
||||
CptGame = CptGame + 1
|
||||
# if event.key == K_UP:
|
||||
if event.key == UP_J1:
|
||||
ROM_L1 = GamePerEmu[CptGame][0][0]
|
||||
ROM_L2 = ROM_L1
|
||||
while (ROM_L1 == ROM_L2):
|
||||
CptGame = CptGame + 1
|
||||
if CptGame >= MaxForThisEmu:
|
||||
CptGame=0
|
||||
break
|
||||
ROM_L1 = GamePerEmu[CptGame][0][0]
|
||||
if event.key == DOWN_J1:
|
||||
# if event.key == K_DOWN:
|
||||
ROM_L1 = GamePerEmu[CptGame][0][0]
|
||||
ROM_L2 = ROM_L1
|
||||
while (ROM_L1 == ROM_L2):
|
||||
CptGame = CptGame - 1
|
||||
if CptGame <= -MaxForThisEmu:
|
||||
CptGame=0
|
||||
break
|
||||
ROM_L1 = GamePerEmu[CptGame][0][0]
|
||||
# LAUNCH GAME
|
||||
if event.key == BTN_J1_1:
|
||||
# if event.key == K_d:
|
||||
FrontEndGame = 1
|
||||
ExitStatus = 0
|
||||
KeepInGame= 1
|
||||
FrontEndEmu = 0
|
||||
GameChoose = GamePerEmu[CptGame][0]
|
||||
DefLaunchSomething(EmuChoose,GameChoose,AllMedia,font,Resolution,BlackImg,WHERE_TEXTE,SIZE_TEXTE,Background,Orientation)
|
||||
|
||||
|
||||
###################################################
|
||||
# DOWNLAOD MEDIA
|
||||
# if event.key == K_f:
|
||||
if event.key == BTN_J1_3:
|
||||
T1=0
|
||||
T2=0
|
||||
|
||||
DownloadGraphical(EmuChoose, GamePerEmu[CptGame][0])
|
||||
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
|
||||
T1=0
|
||||
T2=0
|
||||
###################################################
|
||||
# ESCAPE (keyboard only)
|
||||
if event.key == K_ESCAPE:
|
||||
FrontEndGame = 0
|
||||
ExitStatus = 1
|
||||
KeepInGame=0
|
||||
FrontEndEmu = 0
|
||||
# Back to Emu Selector
|
||||
if event.key == BTN_J1_2:
|
||||
# if event.key == K_e:
|
||||
FrontEndGame = 0
|
||||
ExitStatus = 0
|
||||
KeepInGame = 0
|
||||
FrontEndEmu = 1
|
||||
CptEmu = 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
pygame.mixer.Sound(BeepFileGame).play()
|
||||
|
||||
|
||||
if CptGame >= MaxForThisEmu:
|
||||
CptGame = -MaxForThisEmu
|
||||
|
||||
if CptGame < -MaxForThisEmu:
|
||||
CptGame = MaxForThisEmu -1
|
||||
if MaxForThisEmu == 1:
|
||||
CptGame = 0
|
||||
GameSnapPath=AllMedia+EmuChoose+ "/SNAP/" + GamePerEmu[CptGame][0]+".png"
|
||||
if (os.path.isfile(GameSnapPath)):
|
||||
GameSnap=pygame.transform.scale(pygame.image.load(GameSnapPath).convert_alpha(),SIZE_SNAP_CONVERT)
|
||||
else:
|
||||
GameSnapPath=AllMedia+"/no_snap.png"
|
||||
GameWheelPath=AllMedia+EmuChoose+ "/WHEEL/" + GamePerEmu[CptGame][0]+".png"
|
||||
if (os.path.isfile(GameWheelPath)):
|
||||
GameWheel=pygame.transform.scale(pygame.image.load(GameWheelPath).convert_alpha(),SIZE_WHEEL_CONVERT)
|
||||
else:
|
||||
GameWheelPath=AllMedia+"/no_wheel.png"
|
||||
GameWheel=pygame.transform.scale(pygame.image.load(GameWheelPath).convert_alpha(),SIZE_WHEEL_CONVERT)
|
||||
|
||||
|
||||
GameSnap=pygame.transform.scale(pygame.image.load(GameSnapPath).convert_alpha(),SIZE_SNAP_CONVERT)
|
||||
|
||||
FILE_INFO=AllMedia+EmuChoose+ "/DOCS/" + GamePerEmu[CptGame][0]+".txt"
|
||||
if os.path.isfile(FILE_INFO):
|
||||
FILE_DOC = open(FILE_INFO,"r")
|
||||
text1 = FILE_DOC.read()
|
||||
LPLUS=0
|
||||
LPLUS=LPLUS + (font_size+3)
|
||||
WHERE_TEXTE=(WHERE_TEXTE_X,WHERE_TEXTE_Y)
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE)),(WHERE_TEXTE))
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE)),WHERE_TEXTE)
|
||||
for ligne in text1.splitlines():
|
||||
ligne=ligne[0:max_carac]
|
||||
x,y = PyrScreen.blit(font.render(ligne,1,pygame.Color("red")),(WHERE_TEXTE_X,WHERE_TEXTE_Y+LPLUS)).bottomleft
|
||||
LPLUS=LPLUS + (font_size+1)
|
||||
if ((WHERE_TEXTE_Y + LPLUS) > (SIZE_TEXTE_H*3 +(UNIT_H*2))):
|
||||
break
|
||||
|
||||
FILE_DOC.close()
|
||||
else:
|
||||
text1 = "No DATA File : " + GamePerEmu[CptGame][0]
|
||||
text2 = font.render(text1, True, pygame.Color("red"))
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE_W,SIZE_TEXTE_H)),((WHERE_TEXTE_X,WHERE_TEXTE_Y)))
|
||||
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE)),WHERE_TEXTE)
|
||||
PyrScreen.blit(text2,(WHERE_TEXTE_X,WHERE_TEXTE_Y+50)).bottomleft
|
||||
|
||||
|
||||
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_SNAP_CONVERT)),WHERE_SNAP)
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_SYS_CONVERT)),WHERE_SYS)
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_WHEEL_CONVERT)),WHERE_WHEEL)
|
||||
|
||||
|
||||
PyrScreen.blit(GameSnap,WHERE_SNAP)
|
||||
PyrScreen.blit(GameSys,WHERE_SYS)
|
||||
PyrScreen.blit(GameWheel,WHERE_WHEEL)
|
||||
|
||||
if T1 == 0:
|
||||
T1=strftime("%H%M%S", gmtime())
|
||||
TDiff=int(strftime("%H%M%S", gmtime())) - int(T1)
|
||||
GameVideoPath=AllMedia+EmuChoose+ "/VIDEO/" + GamePerEmu[CptGame][0]+".mpg"
|
||||
|
||||
|
||||
if os.path.isfile(GameVideoPath):
|
||||
if TDiff > 2 and Sys != "Darwin":
|
||||
|
||||
FPS = 60
|
||||
|
||||
pygame.mixer.quit()
|
||||
|
||||
movie = pygame.movie.Movie(GameVideoPath)
|
||||
movie.set_volume(0.8)
|
||||
|
||||
#VIDE FULLSCREEN
|
||||
#mrect = pygame.Rect((0,0),Resolution)
|
||||
|
||||
mrect = pygame.Rect(WHERE_SNAP,SIZE_SNAP_CONVERT)
|
||||
movie.set_display(PyrScreen,mrect)
|
||||
|
||||
|
||||
movie.play()
|
||||
|
||||
while movie.get_busy():
|
||||
evt = pygame.event.wait()
|
||||
if any( [ evt.type == JOYAXISMOTION,evt.type == JOYBUTTONDOWN, evt.type == QUIT,evt.type == KEYDOWN] ):
|
||||
T1=0
|
||||
T2=0
|
||||
movie.stop()
|
||||
movie=None
|
||||
pygame.mixer.init()
|
||||
break
|
||||
pygame.display.flip()
|
||||
pygame.display.flip()
|
||||
return FrontEndGame,ExitStatus,FrontEndEmu,CptEmu
|
||||
84
CONF/DefFrontEndGameMapFile.py
Normal file
@ -0,0 +1,84 @@
|
||||
from math import *
|
||||
|
||||
|
||||
def DefFrontEndGameMap(resolution,Orientation):
|
||||
|
||||
if Orientation == "Y":
|
||||
SCREEN_W,SCREEN_H=resolution
|
||||
SIZE_SNAP_CONVERT_W = int(floor(SCREEN_W / 3))
|
||||
SIZE_SNAP_CONVERT_H = int(floor(SCREEN_H / 5))
|
||||
SIZE_SNAP_CONVERT=(SIZE_SNAP_CONVERT_W,SIZE_SNAP_CONVERT_H)
|
||||
SIZE_WHEEL_CONVERT_W = SIZE_SNAP_CONVERT_W
|
||||
SIZE_WHEEL_CONVERT_H = int(floor(SIZE_WHEEL_CONVERT_W / 4))
|
||||
SIZE_WHEEL_CONVERT=(SIZE_WHEEL_CONVERT_W,SIZE_WHEEL_CONVERT_H)
|
||||
WHERE_WHEEL_X = SIZE_WHEEL_CONVERT_W
|
||||
WHERE_WHEEL_Y = int(floor(SCREEN_H / 10))
|
||||
WHERE_WHEEL=(WHERE_WHEEL_X,WHERE_WHEEL_Y)
|
||||
WHERE_SNAP_X = SIZE_WHEEL_CONVERT_W
|
||||
WHERE_SNAP_Y = WHERE_WHEEL_Y + SIZE_WHEEL_CONVERT_H + SEPARATION_WHEEL_SNAP
|
||||
WHERE_SNAP=(WHERE_SNAP_X,WHERE_SNAP_Y)
|
||||
WHERE_TEXTE_X = WHERE_WHEEL_X
|
||||
WHERE_TEXTE_Y = int(floor(SCREEN_H / 2))
|
||||
SIZE_TEXTE_W = SIZE_SNAP_CONVERT_W
|
||||
SIZE_TEXTE_H = int(floor(SIZE_SNAP_CONVERT_H))
|
||||
WHERE_TEXTE=(WHERE_TEXTE_X,WHERE_TEXTE_Y)
|
||||
SIZE_TEXTE = (SIZE_TEXTE_W,SIZE_TEXTE_H)
|
||||
font_path = "./MEDIA/font.ttf"
|
||||
max_carac = 50
|
||||
font_path = "./MEDIA/font.ttf"
|
||||
max_carac = 30
|
||||
font_size=int(round(floor(SIZE_TEXTE_W / max_carac)))
|
||||
|
||||
# font_size = 20
|
||||
|
||||
|
||||
else:
|
||||
SCREEN_W,SCREEN_H=resolution
|
||||
UNIT_H=int(floor(SCREEN_H/20))
|
||||
UNIT_L=int(floor(SCREEN_W/30))
|
||||
|
||||
|
||||
######### SNAP ########
|
||||
SIZE_SNAP_CONVERT_W = (int(floor((SCREEN_W / 2)-((UNIT_L + UNIT_L/2)))))
|
||||
SIZE_SNAP_CONVERT_H = int(floor(SCREEN_H - (UNIT_H*2 + UNIT_H/2 )))
|
||||
SIZE_SNAP_CONVERT=(SIZE_SNAP_CONVERT_W,SIZE_SNAP_CONVERT_H)
|
||||
WHERE_SNAP_X = int(floor(((SCREEN_W / 2) + (UNIT_L/2))))
|
||||
WHERE_SNAP_Y = UNIT_H
|
||||
WHERE_SNAP=(WHERE_SNAP_X,WHERE_SNAP_Y)
|
||||
|
||||
######### WHEEL ########
|
||||
SIZE_WHEEL_CONVERT_W = SIZE_SNAP_CONVERT_W
|
||||
SIZE_WHEEL_CONVERT_H = int(floor((SCREEN_H /3)-( UNIT_H + UNIT_H/2) ))
|
||||
SIZE_WHEEL_CONVERT=(SIZE_WHEEL_CONVERT_W,SIZE_WHEEL_CONVERT_H)
|
||||
WHERE_WHEEL_X = UNIT_L
|
||||
WHERE_WHEEL_Y = SIZE_WHEEL_CONVERT_H + (UNIT_H * 2)
|
||||
WHERE_WHEEL = (WHERE_WHEEL_X,WHERE_WHEEL_Y)
|
||||
|
||||
########## SYS #########
|
||||
SIZE_SYS_W = SIZE_WHEEL_CONVERT_W
|
||||
SIZE_SYS_H = SIZE_WHEEL_CONVERT_H
|
||||
SIZE_SYS_CONVERT= (SIZE_SYS_W,SIZE_SYS_H)
|
||||
WHERE_SYS_X = UNIT_L
|
||||
WHERE_SYS_Y = UNIT_H
|
||||
WHERE_SYS=(WHERE_SYS_X,WHERE_SYS_Y)
|
||||
|
||||
######### TEXTE ########
|
||||
SIZE_TEXTE_W = SIZE_WHEEL_CONVERT_W
|
||||
SIZE_TEXTE_H = SIZE_WHEEL_CONVERT_H
|
||||
SIZE_TEXTE = (SIZE_TEXTE_W,SIZE_TEXTE_H)
|
||||
WHERE_TEXTE_X = UNIT_L
|
||||
WHERE_TEXTE_Y = (SIZE_WHEEL_CONVERT_H * 2) + (UNIT_H * 3)
|
||||
WHERE_TEXTE=(WHERE_TEXTE_X,WHERE_TEXTE_Y)
|
||||
|
||||
|
||||
|
||||
|
||||
font_path = "./MEDIA/font.ttf"
|
||||
max_carac = 54
|
||||
max_carac = int(floor((SCREEN_W/10) -( SCREEN_W/10 * 2/3)))
|
||||
font_size=int(round(floor((SIZE_TEXTE_W / max_carac))*2))
|
||||
#font_size = 35
|
||||
|
||||
|
||||
return font_path,font_size,max_carac,WHERE_TEXTE,WHERE_TEXTE_X,WHERE_TEXTE_Y,SIZE_TEXTE_W,SIZE_TEXTE_H,SIZE_TEXTE,WHERE_WHEEL,WHERE_SYS,SIZE_WHEEL_CONVERT,WHERE_SNAP,SIZE_SNAP_CONVERT,SIZE_SYS_CONVERT,UNIT_L,UNIT_H
|
||||
|
||||
24
CONF/DefFrontEndGameReadDocsFile.py
Normal file
@ -0,0 +1,24 @@
|
||||
def DefFrontEndGameReadDocs (Resolution,emu,MapingEmu,li,CptEmu,MAX_EMU,MAX):
|
||||
|
||||
|
||||
if os.path.isfile(FILE_INFO):
|
||||
FILE_DOC = open(FILE_INFO,"r")
|
||||
text1 = FILE_DOC.read()
|
||||
LPLUS=0
|
||||
LPLUS=LPLUS + (font_size+5)
|
||||
WHERE_TEXTE=(WHERE_TEXTE_X,WHERE_TEXTE_Y)
|
||||
fenetre.blit(pygame.transform.scale(pygame.image.load(BLACK).convert(),(SIZE_TEXTE)),(WHERE_TEXTE))
|
||||
for ligne in text1.splitlines():
|
||||
ligne=ligne[0:max_carac]
|
||||
x,y = fenetre.blit(font.render(ligne,5,pygame.Color("white")),(WHERE_TEXTE_X,WHERE_TEXTE_Y+LPLUS)).bottomleft
|
||||
LPLUS=LPLUS + (font_size+5)
|
||||
FILE_DOC.close()
|
||||
else:
|
||||
text1 = "No DATA File : " + li[CPT][0]
|
||||
text2 = font.render(text1, True, pygame.Color("white"))
|
||||
fenetre.blit(pygame.transform.scale(pygame.image.load(BLACK).convert(),(SIZE_TEXTE_W,SIZE_TEXTE_H)),((WHERE_TEXTE_X,WHERE_TEXTE_Y)))
|
||||
fenetre.blit(text2,(WHERE_TEXTE_X,WHERE_TEXTE_Y+50)).bottomleft
|
||||
# if not (os.path.isfile(IMG_WHEEL)):
|
||||
# IMG_WHEEL = SNAP_AND_WHEEL + "no_wheel.png"
|
||||
# if not (os.path.isfile(IMG_SNAP)):
|
||||
# IMG_SNAP = SNAP_AND_WHEEL + "no_snap.png"
|
||||
44
CONF/DefLaunchSomethingFile.py
Normal file
@ -0,0 +1,44 @@
|
||||
import os
|
||||
import glob
|
||||
import pygame
|
||||
import subprocess
|
||||
import sys
|
||||
def DefLaunchSomething(EmuChoose,GameChoose,AllMedia,font,Resolution,BlackImg,WHERE_TEXTE,SIZE_TEXTE,Background,Orientation):
|
||||
PyrScreen = pygame.display.set_mode(Resolution)
|
||||
WHERE_TEXTE_W,WHERE_TEXTE_Y=WHERE_TEXTE
|
||||
fond = pygame.transform.scale(pygame.image.load(Background).convert(),Resolution)
|
||||
PyrScreen.blit(fond, (0,0))
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE)),(WHERE_TEXTE))
|
||||
|
||||
PathOfGame=AllMedia+EmuChoose+"/ROMS/"
|
||||
GameChooseJoker=GameChoose + ".*"
|
||||
FullPathJoker=glob.glob(os.path.join(PathOfGame, GameChooseJoker))
|
||||
PathOfBin=AllMedia + "../BIN/"
|
||||
BinCooseJoker=PathOfBin + EmuChoose +".*"
|
||||
FullPathJokerBin=glob.glob(os.path.join(PathOfBin, BinCooseJoker))
|
||||
if FullPathJokerBin:
|
||||
BinFullPathJoker=FullPathJokerBin[0]
|
||||
if EmuChoose == "SYS":
|
||||
##print "EmuChoose: " + EmuChoose + " | GameChoose : " + GameChoose
|
||||
APP=BinFullPathJoker + " " + GameChoose + " " + Orientation
|
||||
p = subprocess.Popen(APP, shell=True)
|
||||
sys.exit("GO play bitch ;)")
|
||||
else:
|
||||
if FullPathJoker:
|
||||
GameFullPathJoker=FullPathJoker[0]
|
||||
else:
|
||||
GameFullPathJoker="xxxxxxxxxxxxxxxxxxxxx"
|
||||
if (os.path.isfile(GameFullPathJoker)):
|
||||
##print "EmuChoose: " + EmuChoose + " | GameChoose : " + GameChoose
|
||||
APP="BIN/" + EmuChoose +".sh" + " " + GameChoose + " " + Orientation
|
||||
p = subprocess.Popen(APP, shell=True)
|
||||
sys.exit("GO play bitch ;)")
|
||||
|
||||
else:
|
||||
##print "Roms " + GameChoose + " NOT FOUND " + AllMedia+EmuChoose + "/ROMS/"
|
||||
text1 = "Roms " + GameChoose + " NOT FOUND"
|
||||
text2 = font.render(text1, True, pygame.Color("white"))
|
||||
PyrScreen.blit(pygame.transform.scale(pygame.image.load(BlackImg).convert(),(SIZE_TEXTE)),((WHERE_TEXTE)))
|
||||
PyrScreen.blit(text2,(WHERE_TEXTE_W,WHERE_TEXTE_Y)).bottomleft
|
||||
|
||||
|
||||
15
CONF/DefReadConfGameFile.py
Normal file
@ -0,0 +1,15 @@
|
||||
#COMPTEUR et lecture du fichier conf
|
||||
import csv
|
||||
def DefReadConfGame(rom_config_file,EmuChoose,li):
|
||||
GamePerEmu = []
|
||||
MaxForThisEmu = 0
|
||||
for row2 in li:
|
||||
GameListe,EmuListe=row2
|
||||
if EmuListe == EmuChoose:
|
||||
GamePerEmu.append(row2)
|
||||
MaxForThisEmu=MaxForThisEmu+1
|
||||
def getKey(item):
|
||||
return item[0]
|
||||
sorted(GamePerEmu, key=getKey)
|
||||
GamePerEmu
|
||||
return GamePerEmu,MaxForThisEmu
|
||||
24
CONF/DefReadConfRomFile.py
Normal file
@ -0,0 +1,24 @@
|
||||
#COMPTEUR et lecture du fichier conf
|
||||
import csv
|
||||
def DefReadConfRom(rom_config_file):
|
||||
reader = csv.reader(open(rom_config_file),delimiter=',')
|
||||
li = []
|
||||
emu = []
|
||||
GamePerEmu = []
|
||||
MAX = 0
|
||||
MAX_EMU = 0
|
||||
|
||||
for row in reader:
|
||||
if row:
|
||||
li.append(row)
|
||||
if not (li[MAX][1] in emu):
|
||||
emu.append(li[MAX][1])
|
||||
MAX_EMU=MAX_EMU +1
|
||||
|
||||
MAX = MAX +1
|
||||
def getKey(item):
|
||||
return item[1]
|
||||
sorted(li, key=getKey)
|
||||
|
||||
#return {'MAX':MAX, 'MAX_EMU':MAX_EMU,'li':li,'emu':emu}
|
||||
return MAX,MAX_EMU,li,emu
|
||||
16
CONF/DefResAndSysFile.py
Normal file
@ -0,0 +1,16 @@
|
||||
import pygame
|
||||
import subprocess
|
||||
|
||||
def DefResolution():
|
||||
screen = pygame.display.set_mode((0,0))
|
||||
screen.fill((0,0,180))
|
||||
size = screen.get_rect()
|
||||
SCREEN_W = size[2]
|
||||
SCREEN_H = size[3]
|
||||
return SCREEN_W,SCREEN_H
|
||||
#return 1280,1024
|
||||
|
||||
def DefSystem():
|
||||
p = subprocess.check_output(['uname'])
|
||||
sys_check = p.strip()
|
||||
return sys_check
|
||||
39
CONF/DefTransition.py
Normal file
@ -0,0 +1,39 @@
|
||||
import pygame
|
||||
import sys
|
||||
import time
|
||||
import subprocess
|
||||
import os
|
||||
from pygame.locals import *
|
||||
from DefFrontEndEmuMapFile import *
|
||||
from DefFrontEndEmuFile import *
|
||||
from ConfAllPath import *
|
||||
from DefFrontEndGameMapFile import DefFrontEndGameMap
|
||||
from DefLaunchSomethingFile import DefLaunchSomething
|
||||
from DefDownladPerGame import DownloadGraphical
|
||||
from DefCheckEnvFile import DefCheckEnv
|
||||
|
||||
|
||||
|
||||
def Transition(Resolution,emu,MapingEmu,li,CptEmu,MAX_EMU,MAX,Orientation):
|
||||
PyrScreen = pygame.display.set_mode(Resolution,FULLSCREEN)
|
||||
pygame.mixer.quit()
|
||||
movie = pygame.movie.Movie('MEDIA/boom.mpg')
|
||||
movie.set_volume(0.8)
|
||||
|
||||
#VIDE FULLSCREEN
|
||||
mrect = pygame.Rect((0,0),Resolution)
|
||||
|
||||
#mrect = pygame.Rect(WHERE_SNAP,SIZE_SNAP_CONVERT)
|
||||
movie.set_display(PyrScreen,mrect)
|
||||
movie.play()
|
||||
while movie.get_busy():
|
||||
evt = pygame.event.wait()
|
||||
if any( [ evt.type == JOYAXISMOTION,evt.type == JOYBUTTONDOWN, evt.type == QUIT,evt.type == KEYDOWN] ):
|
||||
T1=0
|
||||
T2=0
|
||||
movie.stop()
|
||||
movie=None
|
||||
pygame.mixer.init()
|
||||
break
|
||||
pygame.display.flip()
|
||||
|
||||
BIN
MEDIA/IMG/EMU/CPS.png
Normal file
|
After Width: | Height: | Size: 188 KiB |
BIN
MEDIA/IMG/EMU/CPS3.png
Normal file
|
After Width: | Height: | Size: 290 KiB |
BIN
MEDIA/IMG/EMU/FBA.png
Normal file
|
After Width: | Height: | Size: 120 KiB |
BIN
MEDIA/IMG/EMU/GAMEBOY.png
Normal file
|
After Width: | Height: | Size: 138 KiB |
BIN
MEDIA/IMG/EMU/GAME_GEAR.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
MEDIA/IMG/EMU/GAW.png
Normal file
|
After Width: | Height: | Size: 68 KiB |
BIN
MEDIA/IMG/EMU/GNGEO.png
Normal file
|
After Width: | Height: | Size: 331 KiB |
BIN
MEDIA/IMG/EMU/LOGO/CPS3.png
Normal file
|
After Width: | Height: | Size: 72 KiB |
BIN
MEDIA/IMG/EMU/LOGO/FBA.png
Normal file
|
After Width: | Height: | Size: 59 KiB |
BIN
MEDIA/IMG/EMU/LOGO/GAMEBOY.png
Normal file
|
After Width: | Height: | Size: 16 KiB |
BIN
MEDIA/IMG/EMU/LOGO/GAW.png
Normal file
|
After Width: | Height: | Size: 49 KiB |
BIN
MEDIA/IMG/EMU/LOGO/GNGEO.png
Normal file
|
After Width: | Height: | Size: 39 KiB |
BIN
MEDIA/IMG/EMU/LOGO/MAME.png
Normal file
|
After Width: | Height: | Size: 78 KiB |
BIN
MEDIA/IMG/EMU/LOGO/N64.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
MEDIA/IMG/EMU/LOGO/NES.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
MEDIA/IMG/EMU/LOGO/PS1.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
MEDIA/IMG/EMU/LOGO/SNES.png
Normal file
|
After Width: | Height: | Size: 13 KiB |
BIN
MEDIA/IMG/EMU/MAME.png
Normal file
|
After Width: | Height: | Size: 188 KiB |
BIN
MEDIA/IMG/EMU/MASTER_SYSTEM.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
MEDIA/IMG/EMU/N64.png
Normal file
|
After Width: | Height: | Size: 231 KiB |
BIN
MEDIA/IMG/EMU/NEOGEO.png
Normal file
|
After Width: | Height: | Size: 184 KiB |
BIN
MEDIA/IMG/EMU/NES.png
Normal file
|
After Width: | Height: | Size: 88 KiB |
BIN
MEDIA/IMG/EMU/PGM.png
Normal file
|
After Width: | Height: | Size: 188 KiB |
BIN
MEDIA/IMG/EMU/PS1.png
Normal file
|
After Width: | Height: | Size: 164 KiB |
BIN
MEDIA/IMG/EMU/SNES.png
Normal file
|
After Width: | Height: | Size: 114 KiB |
BIN
MEDIA/IMG/EMU/SYS.png
Normal file
|
After Width: | Height: | Size: 125 KiB |
BIN
MEDIA/IMG/EMU/no_emu.png
Normal file
|
After Width: | Height: | Size: 301 KiB |
BIN
MEDIA/IMG/IMGX/CPS3.png
Normal file
|
After Width: | Height: | Size: 191 KiB |
BIN
MEDIA/IMG/IMGX/FBA.png
Normal file
|
After Width: | Height: | Size: 362 KiB |
BIN
MEDIA/IMG/IMGX/GAMEBOY.png
Normal file
|
After Width: | Height: | Size: 156 KiB |
BIN
MEDIA/IMG/IMGX/GAW.png
Normal file
|
After Width: | Height: | Size: 470 KiB |
BIN
MEDIA/IMG/IMGX/GNGEO.png
Normal file
|
After Width: | Height: | Size: 180 KiB |
BIN
MEDIA/IMG/IMGX/MAME.png
Normal file
|
After Width: | Height: | Size: 221 KiB |
BIN
MEDIA/IMG/IMGX/N64.png
Normal file
|
After Width: | Height: | Size: 165 KiB |
BIN
MEDIA/IMG/IMGX/NES.png
Normal file
|
After Width: | Height: | Size: 202 KiB |
BIN
MEDIA/IMG/IMGX/PS1.png
Normal file
|
After Width: | Height: | Size: 404 KiB |