當前位置: 首頁>>代碼示例>>Python>>正文


Python gb.Gb類代碼示例

本文整理匯總了Python中com.aurellem.gb.Gb的典型用法代碼示例。如果您正苦於以下問題:Python Gb類的具體用法?Python Gb怎麽用?Python Gb使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Gb類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_ram

def get_ram():
    """
    Returns the RAM in bytes.
    """
    ram_array = jarray.zeros(Gb.RAM_SIZE, "i")
    Gb.getRAM(ram_array)
    return RomList(ram_array)
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:7,代碼來源:vba.py

示例2: shutdown

def shutdown():
    """
    Stops the emulator. Closes the window.

    The "opposite" of this is the load_rom function.
    """
    Gb.shutdown()
開發者ID:cogitokat,項目名稱:pokemon-reverse-engineering-tools,代碼行數:7,代碼來源:vba.py

示例3: set_memory

def set_memory(memory):
    """
    Sets memory in the emulator.

    Use get_memory() to retrieve the current state.
    """
    Gb.writeMemory(memory)
開發者ID:cogitokat,項目名稱:pokemon-reverse-engineering-tools,代碼行數:7,代碼來源:vba.py

示例4: remove_cheat

    def remove_cheat(id):
        """
        Removes a specific cheat from memory by id.

        void gbCheatRemove(int i)
        """
        Gb.cheatRemove(id)
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:7,代碼來源:vba.py

示例5: get_registers

def get_registers():
    """
    Returns a list of current register values.
    """
    register_array = jarray.zeros(Gb.NUM_REGISTERS, "i")
    Gb.getRegisters(register_array)
    return list(register_array)
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:7,代碼來源:vba.py

示例6: remove_all

    def remove_all():
        """
        Removes all cheats from memory.

        void gbCheatRemoveAll()
        """
        Gb.cheatRemoveAll()
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:7,代碼來源:vba.py

示例7: get_rom

def get_rom():
    """
    Returns the ROM in bytes.
    """
    rom_array = jarray.zeros(Gb.ROM_SIZE, "i")
    Gb.getROM(rom_array)
    return RomList(rom_array)
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:7,代碼來源:vba.py

示例8: get_memory

def get_memory():
    """
    Returns memory in bytes.
    """
    memory_size = 0x10000
    memory = jarray.zeros(memory_size, "i")
    Gb.getMemory(memory)
    return RomList(memory)
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:8,代碼來源:vba.py

示例9: set_memory_at

def set_memory_at(address, value):
    """
    Sets a byte at a certain address in memory.

    This directly sets the memory instead of copying
    the memory from the emulator.
    """
    Gb.setMemoryAt(address, value)
開發者ID:cogitokat,項目名稱:pokemon-reverse-engineering-tools,代碼行數:8,代碼來源:vba.py

示例10: set_state

def set_state(state, do_step=False):
    """
    Injects the given state into the emulator. Use do_step if you want to call
    step(), which also allows SDL to render the latest frame. Note that the
    default is to not step, and that the screen (if it is enabled) will appear
    as if it still has the last state loaded. This is normal.
    """
    Gb.loadState(_create_byte_buffer(state))
    if do_step:
        step()
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:10,代碼來源:vba.py

示例11: get_pixels

def get_pixels():
    """
    Returns a list of pixels on the screen display. Broken, probably. Use
    screenshot() instead.
    """
    sys.stderr.write("ERROR: seems to be broken on VBA's end? Good luck. Use"
    " screenshot() instead.\n")
    size = Gb.DISPLAY_WIDTH * Gb.DISPLAY_HEIGHT
    pixels = jarray.zeros(size, "i")
    Gb.getPixels(pixels)
    return RomList(pixels)
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:11,代碼來源:vba.py

示例12: screenshot

def screenshot(filename, literal=False):
    """
    Saves a PNG screenshot to the file at filename. Use literal if you want to
    store it in the current directory. Default is to save it to screenshots/
    under the project.
    """
    screenshots_path = os.path.join(project_path, "screenshots/")
    filename = os.path.join(screenshots_path, filename)
    if len(filename) < 4 or filename[-4:] != ".png":
        filename += ".png"
    Gb.nwritePNG(filename)
    print "Screenshot saved to: " + str(filename)
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:12,代碼來源:vba.py

示例13: press

def press(buttons, steplimit=1):
    """
    Press a button. Use steplimit to say for how many steps you want to press
    the button (try leaving it at the default, 1).
    """
    if hasattr(buttons, "__len__"):
        number = button_combiner(buttons)
    elif isinstance(buttons, int):
        number = buttons
    else:
        number = buttons
    for step_counter in range(0, steplimit):
        Gb.step(number)
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:13,代碼來源:vba.py

示例14: get_buttons

def get_buttons():
    """
    Returns the currentButtons[0] value

    (an integer with bits set for which
    buttons are currently pressed).
    """
    return Gb.getCurrentButtons()
開發者ID:cogitokat,項目名稱:pokemon-reverse-engineering-tools,代碼行數:8,代碼來源:vba.py

示例15: load_rom

def load_rom(path=None):
    """
    Starts the emulator with a certain ROM. Defaults to rom_path if no
    parameters are given.
    """
    if path == None:
        path = rom_path
    try:
        root = load_state("root")
    except:
        # "root.sav" is required because if you create it in the future, you
        # will have to shutdown the emulator and possibly lose your state. Some
        # functions require there to be at least one root state available to do
        # computations between two states.
        sys.stderr.write("ERROR: unable to read \"root.sav\", please run"
        " generate_root() or get_root() to make an initial save.\n")
    Gb.startEmulator(path)
開發者ID:PapaDoc6,項目名稱:pokecrystal,代碼行數:17,代碼來源:vba.py


注:本文中的com.aurellem.gb.Gb類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。