Ejemplo n.º 1
0
 def set_items(self):
     if not SDL_WasInit(SDL_INIT_VIDEO):
         SDL_InitSubSystem(SDL_INIT_VIDEO)
     self.get_opts(), self.get_keys()
     self.set_opts(), self.set_keys()
     if SDL_WasInit(SDL_INIT_VIDEO):
         SDL_QuitSubSystem(SDL_INIT_VIDEO)
Ejemplo n.º 2
0
 def test_init_quit(self):
     sdl2ext.init()
     self.assertEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
     sdl2ext.quit()
     self.assertNotEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
     sdl2ext.init()
     sdl2ext.init()
     sdl2ext.init()
     self.assertEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
     sdl2ext.quit()
     self.assertNotEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
     sdl2ext.quit()
     sdl2ext.quit()
     sdl2ext.quit()
     self.assertNotEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
Ejemplo n.º 3
0
 def test_SDL_INIT_AUDIO(self):
     ret = SDL_Init(SDL_INIT_AUDIO)
     if ret != 0:
         pytest.skip('Audio subsystem not supported')
     ret = SDL_WasInit(SDL_INIT_AUDIO)
     assert ret == SDL_INIT_AUDIO
     SDL_QuitSubSystem(SDL_INIT_AUDIO)
Ejemplo n.º 4
0
 def test_SDL_INIT_TIMER(self):
     ret = SDL_Init(SDL_INIT_TIMER)
     if ret != 0:
         pytest.skip('Timer subsystem not supported')
     ret = SDL_WasInit(SDL_INIT_TIMER)
     assert ret == SDL_INIT_TIMER
     SDL_QuitSubSystem(SDL_INIT_TIMER)
Ejemplo n.º 5
0
 def test_SDL_INIT_VIDEO(self):
     ret = SDL_Init(SDL_INIT_VIDEO)
     if ret != 0:
         self.skipTest('Video subsystem not supported')
     ret = SDL_WasInit(SDL_INIT_VIDEO)
     self.assertEqual(ret, SDL_INIT_VIDEO)
     SDL_QuitSubSystem(SDL_INIT_VIDEO)
Ejemplo n.º 6
0
 def test_SDL_INIT_JOYSTICK(self):
     ret = SDL_Init(SDL_INIT_JOYSTICK)
     if ret != 0:
         pytest.skip('Joystick subsystem not supported')
     ret = SDL_WasInit(SDL_INIT_JOYSTICK)
     assert ret == SDL_INIT_JOYSTICK
     SDL_QuitSubSystem(SDL_INIT_JOYSTICK)
Ejemplo n.º 7
0
 def test_SDL_INIT_HAPTIC(self):
     ret = SDL_Init(SDL_INIT_HAPTIC)
     if ret != 0:
         pytest.skip('Haptic subsystem not supported')
     ret = SDL_WasInit(SDL_INIT_HAPTIC)
     assert ret == SDL_INIT_HAPTIC
     SDL_QuitSubSystem(SDL_INIT_HAPTIC)
Ejemplo n.º 8
0
 def test_SDL_INIT_HAPTIC(self):
     ret = SDL_Init(SDL_INIT_HAPTIC)
     if ret != 0:
         self.skipTest('Haptic subsystem not supported')
     ret = SDL_WasInit(SDL_INIT_HAPTIC)
     self.assertEqual(ret, SDL_INIT_HAPTIC)
     SDL_QuitSubSystem(SDL_INIT_HAPTIC)
Ejemplo n.º 9
0
 def test_SDL_INIT_JOYSTICK(self):
     ret = SDL_Init(SDL_INIT_JOYSTICK)
     if ret != 0:
         self.skipTest('Joystick subsystem not supported')
     ret = SDL_WasInit(SDL_INIT_JOYSTICK)
     self.assertEqual(ret, SDL_INIT_JOYSTICK)
     SDL_QuitSubSystem(SDL_INIT_JOYSTICK)
Ejemplo n.º 10
0
 def test_SDL_INIT_VIDEO(self):
     ret = SDL_Init(SDL_INIT_VIDEO)
     if ret != 0:
         pytest.skip('Video subsystem not supported')
     ret = SDL_WasInit(SDL_INIT_VIDEO)
     assert ret == SDL_INIT_VIDEO
     SDL_QuitSubSystem(SDL_INIT_VIDEO)
Ejemplo n.º 11
0
 def test_SDL_INIT_TIMER(self):
     ret = SDL_Init(SDL_INIT_TIMER)
     if ret != 0:
         self.skipTest('Timer subsystem not supported')
     ret = SDL_WasInit(SDL_INIT_TIMER)
     self.assertEqual(ret, SDL_INIT_TIMER)
     SDL_QuitSubSystem(SDL_INIT_TIMER)
Ejemplo n.º 12
0
    def init(self):
        if not SDL_WasInit(SDL_INIT_JOYSTICK):
            if SDL_InitSubSystem(SDL_INIT_JOYSTICK) == 0:
                for i in range(SDL_NumJoysticks()):
                    self.joystick_names.append(SDL_JoystickNameForIndex(i))

                self.joystick_timer.timeout.connect(self.process_events)
            else:
                log.info("couldn't initialize SDL joystick support")
Ejemplo n.º 13
0
 def test_init_quit(self):
     try:
         sdl2ext.init()
     except sdl2ext.SDLError:
         raise unittest.SkipTest('Video subsystem not supported')
     self.assertEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
     sdl2ext.quit()
     self.assertNotEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
     sdl2ext.init()
     sdl2ext.init()
     sdl2ext.init()
     self.assertEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
     sdl2ext.quit()
     self.assertNotEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
     sdl2ext.quit()
     sdl2ext.quit()
     sdl2ext.quit()
     self.assertNotEqual(SDL_WasInit(SDL_INIT_VIDEO), SDL_INIT_VIDEO)
Ejemplo n.º 14
0
 def test_init_quit(self):
     try:
         sdl2ext.init()
     except sdl2ext.SDLError:
         raise pytest.skip('Video subsystem not supported')
     assert SDL_WasInit(SDL_INIT_VIDEO) == SDL_INIT_VIDEO
     sdl2ext.quit()
     assert SDL_WasInit(SDL_INIT_VIDEO) != SDL_INIT_VIDEO
     sdl2ext.init()
     sdl2ext.init()
     sdl2ext.init()
     assert SDL_WasInit(SDL_INIT_VIDEO) == SDL_INIT_VIDEO
     sdl2ext.quit()
     assert SDL_WasInit(SDL_INIT_VIDEO) != SDL_INIT_VIDEO
     sdl2ext.quit()
     sdl2ext.quit()
     sdl2ext.quit()
     assert SDL_WasInit(SDL_INIT_VIDEO) != SDL_INIT_VIDEO
Ejemplo n.º 15
0
 def signal_handler(signum, frame):
     signal.signal(signal.SIGINT, signal.SIG_IGN)
     signal.signal(signal.SIGTERM, signal.SIG_IGN)
     if tty_fd:
         os.close(tty_fd)
     if SDL_WasInit(SDL_INIT_JOYSTICK) == SDL_INIT_JOYSTICK:
         SDL_QuitSubSystem(SDL_INIT_JOYSTICK)
     SDL_Quit()
     LOG.debug(f'{sys.argv[0]} exiting cleanly')
     sys.exit(0)
Ejemplo n.º 16
0
    def init(self):
        if not SDL_WasInit(SDL_INIT_JOYSTICK):
            if SDL_InitSubSystem(SDL_INIT_JOYSTICK) == 0:
                for i in range(SDL_NumJoysticks()):
                    joystick_name = SDL_JoystickNameForIndex(i)
                    if isinstance(joystick_name, bytes):
                        joystick_name = joystick_name.decode()
                    self.joystick_names.append(joystick_name.strip())

                self.joystick_timer.timeout.connect(self.process_events)
            else:
                log.info("couldn't initialize SDL joystick support")
Ejemplo n.º 17
0
    # nvidia hack
    from OpenGL import GL
    glimport = True
except:
    glimport = False

from PyQt5.QtOpenGL import QGLFormat

from sdl2 import SDL_WasInit, SDL_InitSubSystem, SDL_QuitSubSystem, SDL_INIT_VIDEO
from sdl2 import SDL_GetNumDisplayModes, SDL_DisplayMode, SDL_GetDisplayMode

from m64py.core.defs import *
from m64py.frontend.log import log

try:
    if not SDL_WasInit(SDL_INIT_VIDEO):
        SDL_InitSubSystem(SDL_INIT_VIDEO)
    MODES = []
    display = SDL_DisplayMode()
    for mode in range(SDL_GetNumDisplayModes(0)):
        ret = SDL_GetDisplayMode(0, mode, ctypes.byref(display))
        if (display.w, display.h) not in MODES:
            MODES.append((display.w, display.h))
    if SDL_WasInit(SDL_INIT_VIDEO):
        SDL_QuitSubSystem(SDL_INIT_VIDEO)
except Exception as err:
    log.warn(str(err))


class Video():
    """Mupen64Plus video extension"""
Ejemplo n.º 18
0
 def test_SDL_INIT_HAPTIC(self):
     ret = SDL_Init(SDL_INIT_HAPTIC)
     self.assertEqual(ret, 0, SDL_GetError())
     ret = SDL_WasInit(SDL_INIT_HAPTIC)
     self.assertEqual(ret, SDL_INIT_HAPTIC)
     SDL_QuitSubSystem(SDL_INIT_HAPTIC)