本文整理汇总了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)
示例2: shutdown
def shutdown():
"""
Stops the emulator. Closes the window.
The "opposite" of this is the load_rom function.
"""
Gb.shutdown()
示例3: set_memory
def set_memory(memory):
"""
Sets memory in the emulator.
Use get_memory() to retrieve the current state.
"""
Gb.writeMemory(memory)
示例4: remove_cheat
def remove_cheat(id):
"""
Removes a specific cheat from memory by id.
void gbCheatRemove(int i)
"""
Gb.cheatRemove(id)
示例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)
示例6: remove_all
def remove_all():
"""
Removes all cheats from memory.
void gbCheatRemoveAll()
"""
Gb.cheatRemoveAll()
示例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)
示例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)
示例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)
示例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()
示例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)
示例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)
示例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)
示例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()
示例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)