Skip to content
Open
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
24a9476
Stubbed out metroid II wrapper with minimum funcitonallity
benlagreca02 Jan 17, 2025
328bf01
Added most memory values from the ram mapping website. Next, need to …
benlagreca02 Jan 23, 2025
f9dfd63
game_start implemented, may be able to shave time off but it works
benlagreca02 Jan 23, 2025
43fc5b7
Great progress, getting lots of intermediary values, may still want t…
benlagreca02 Jan 27, 2025
18f0d88
Start function doesn't render anymore, fixed small bug with pixels/ar…
benlagreca02 Jan 27, 2025
ed59aa0
removed print statement left over from debugging
benlagreca02 Jan 28, 2025
89e3040
Minor change to reset function
benlagreca02 Jan 30, 2025
7436cf3
pre-commit all files with ruff linting and formating
Baekalfen Nov 15, 2024
d1a9dc5
Fix placement of log_level in PyBoy.__init__
Baekalfen Nov 15, 2024
556da6f
Introduce PyBoyException
Baekalfen Nov 15, 2024
2aa0eb8
Introduce exceptions to all load_state
Baekalfen Nov 15, 2024
8d6a06d
Track if compiled with Cython from utils
Baekalfen Nov 15, 2024
c15abf7
Introduce PyBoyDependencyError and PillowImportError
Baekalfen Nov 15, 2024
dee0ffd
Convert existing Exception to PyBoyException
Baekalfen Nov 21, 2024
18623f0
Update Discord invite to channel "rules"
Baekalfen Nov 21, 2024
3cdb781
Replace asserts with PyBoyExceptions
Baekalfen Nov 21, 2024
0bf4232
Add button test
Baekalfen Nov 21, 2024
8f417f7
Fix use of noexcept to remove warnings
Baekalfen Nov 21, 2024
715cbb0
Move CGB rendering from Renderer to CGBRenderer
Baekalfen Nov 21, 2024
80c2df3
Actually release the GIL and benchmark to test it
Baekalfen Nov 21, 2024
28b6711
Update tests to new exceptions
Baekalfen Nov 21, 2024
20a960a
Mock cython.gil/nogil when Cython is not present (PyPy)
Baekalfen Nov 23, 2024
9822969
Clean up unused "is_pypy"
Baekalfen Nov 23, 2024
0ef64b1
Skip doctests if compiled with Cython instead of failing
Baekalfen Nov 23, 2024
17dc6f3
Add pytest.ini options to pyproject.toml; ignore SDL2 warning; disabl…
Baekalfen Nov 23, 2024
9053e4a
Add benchmarking to CI
Baekalfen Nov 23, 2024
0ef41fb
Remove Python 3.8 EOL
Baekalfen Nov 23, 2024
daa2224
Automatically add documentation for plugins to PyBoy constructor
Baekalfen Dec 6, 2024
6089c29
Add missing gameshark doc
Baekalfen Dec 6, 2024
6ef4a4a
Add set_time_left to Mario wrapper, change error to exception
Baekalfen Dec 11, 2024
b9279d4
Improve Makefile docs
Baekalfen Dec 11, 2024
56b1097
Remove .stop() from tests as it saves RAM, while __del__ does not. Th…
Baekalfen Dec 11, 2024
8b92512
Move color_palette and cgb_color_palette to PyBoy constructor
Baekalfen Dec 11, 2024
58d39d0
Fix no_input, test and move it from plugin to PyBoy
Baekalfen Dec 11, 2024
baa4168
Fix singlestepping after CPU cycles_target has been introduced
Baekalfen Dec 27, 2024
43090e8
Add vectroid to tests. Not booting
Baekalfen Dec 16, 2024
e763918
Fixed punctuation
Baekalfen Dec 13, 2024
aeec17e
Move test-skips from "is_pypy" to "cython_compiled"
Baekalfen Dec 16, 2024
55f9137
Comprehensive testing of save/load state
Baekalfen Feb 11, 2025
3c45e45
Introduce DEBUG var in setup.py
Baekalfen Dec 27, 2024
ce0f6e5
Add TurtleTests
Baekalfen Dec 23, 2024
e4e1b2a
Fix events not cleared on pause and verify with toggle
Baekalfen Jan 17, 2025
99b8e35
Fix missing return in breakpoint symbol lookup
Baekalfen Jan 17, 2025
1631883
Add '.inner_loop' to default_rom for testing
Baekalfen Dec 29, 2024
2d198f6
Added log debug to CGB speed switching
Baekalfen Jan 17, 2025
f99a4be
Correct screen documentation to say "memoryview" instead of "bytes"
Baekalfen Jan 20, 2025
687224f
BasePlugin: Only run frame limiter when speed limit is not 0
Baekalfen Feb 10, 2025
e5b2957
Force closing of debug windows
Baekalfen Feb 9, 2025
68f67da
Fix wrong serialization of scanline parameters in saved state
Baekalfen Dec 15, 2024
c57e94e
Fix save/load state of STATRegister not restoring mode correctly
Baekalfen Dec 15, 2024
0d3a22a
Fix deprecation warning for RGBDS
Baekalfen Feb 9, 2025
3792008
Convert RTC usage of float to double, and remove cast to int
Baekalfen Jan 20, 2025
e85ab7a
Fix duplicate test_tiles_cgb and correct test to work
Baekalfen Feb 11, 2025
9aa166e
Add _cycles_to_interrupt to Timer save/load state
Baekalfen Dec 15, 2024
603c456
Fix LCD save/load state frame cycles and frame_done
Baekalfen Feb 11, 2025
a030553
Updating Blargg sound test results, although sound is not implemented
Baekalfen Feb 11, 2025
084935e
Most changes requested by Baekalfen made. Still need to change game o…
benlagreca02 Feb 12, 2025
18b656e
PyBoyPlugin Cython move cgb attribute
BackrndSource Feb 10, 2025
8d6a2eb
game_wrapper.game_area should work without rendering screen
BackrndSource Feb 10, 2025
17fa2cd
Wrap WindowEvents in class to avoid issues with mixed types
BackrndSource Feb 11, 2025
293a5fc
Stubbed out metroid II wrapper with minimum funcitonallity
benlagreca02 Jan 17, 2025
1ba2744
Added most memory values from the ram mapping website. Next, need to …
benlagreca02 Jan 23, 2025
1a8ef18
game_start implemented, may be able to shave time off but it works
benlagreca02 Jan 23, 2025
139f6ff
Great progress, getting lots of intermediary values, may still want t…
benlagreca02 Jan 27, 2025
1b7fd56
Start function doesn't render anymore, fixed small bug with pixels/ar…
benlagreca02 Jan 27, 2025
0e8466a
removed print statement left over from debugging
benlagreca02 Jan 28, 2025
e7bd4cd
Minor change to reset function
benlagreca02 Jan 30, 2025
c5e9747
Most changes requested by Baekalfen made. Still need to change game o…
benlagreca02 Feb 12, 2025
63cfc5d
Merge fixed hopefully?
benlagreca02 Feb 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions pyboy/plugins/game_wrapper_metroid_ii.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# License: See LICENSE.md file
# GitHub: https://github.com/Baekalfen/PyBoy
#
cimport cython
from libc.stdint cimport uint8_t

from pyboy.logging.logging cimport Logger
from pyboy.plugins.base_plugin cimport PyBoyGameWrapper


cdef Logger logger

cdef int ROWS, COLS


cdef class GameWrapperMetroidII(PyBoyGameWrapper):
cdef readonly int _game_over
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

readonly makes it available on the API. No need to have this, when we have the game_over method as well.

cdef readonly int x_pos_pixels
cdef readonly int y_pos_pixels
cdef readonly int x_pos_area
cdef readonly int y_pos_area
cdef readonly int pose

cdef readonly int samus_facing
cdef readonly int current_major_upgrades
cdef readonly int water_info
cdef readonly int current_beam
cdef readonly int current_e_tanks
cdef readonly int current_hp
cdef readonly int current_full_e_tanks
cdef readonly int current_missiles
cdef readonly int current_missile_capacity
cdef readonly int displayed_hp
cdef readonly int displayed_missiles
cdef readonly int global_metroid_count
cdef readonly int local_metroid_count



191 changes: 191 additions & 0 deletions pyboy/plugins/game_wrapper_metroid_ii.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
#
# License: See LICENSE.md file
# GitHub: https://github.com/Baekalfen/PyBoy
#
__pdoc__ = {
"GameWrapperMetroidII.cartridge_title": False,
"GameWrapperMetroidII.post_tick": False,
}

import pyboy
from pyboy import utils
from pyboy.utils import WindowEvent
# for memory
from pyboy.utils import bcd_to_dec

from .base_plugin import PyBoyGameWrapper

logger = pyboy.logging.get_logger(__name__)


class GameWrapperMetroidII(PyBoyGameWrapper):
"""
This class wraps Metroid II, and provides easy access for AIs.
If you call `print` on an instance of this object, it will show an overview of everything this object provides.
"""
cartridge_title = "METROID2"

def __init__(self, *args, **kwargs):
self._game_over = False
# may need to change game area section. Copied from the kirby code
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you check out what the game area should be?

super().__init__(*args, game_area_section=(0, 0, 20, 16), game_area_follow_scxy=True, **kwargs)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add all the attributes you've added here and give them a default value? And underneath each attribute add a docstring?


def post_tick(self):
self._tile_cache_invalid = True
self._sprite_cache_invalid = True

# Access RAM for a ton of information about the game
# I'm getting all of the values from datacrystal
# https://datacrystal.tcrf.net/wiki/Metroid_II:_Return_of_Samus/RAM_map
# I've skipped some of the values like music related ones

# Constants from decomp project
# https://github.com/alex-west/M2RoS/blob/main/SRC/constants.asm
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe condense this down to:

# RAM addresses and constants sourced from:
# https://datacrystal.tcrf.net/wiki/Metroid_II:_Return_of_Samus/RAM_map
# https://github.com/alex-west/M2RoS/blob/main/SRC/constants.asm



# Check screen for the word "GAME" (as in GAME OVER)
# this could be done much faster by checking health
# There's a death animation so the extra few seconds over thousands of
# runs *could* add up?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then shouldn't we use this method instead?

if self.tilemap_background[6:10, 8] == [342, 336, 348, 340]:
self._game_over = True
# No need to update the rest of the values, we're dead!
return

# X position within area (pixels/screen)
self.x_pos_pixels = self.pyboy.memory[0xD027]
self.y_pos_pixels = self.pyboy.memory[0xD029]
self.x_pos_area = self.pyboy.memory[0xD028]
self.y_pos_area = self.pyboy.memory[0xD02A]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the difference between "pixels" and "area"?


self.pose = self.pyboy.memory[0xD020]

self.samus_facing = self.pyboy.memory[0xD02B]
self.current_major_upgrades = self.pyboy.memory[0xD045]
# Yeah I have no idea, just says "related to interacting with water"
self.water_info = self.pyboy.memory[0xD048]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't need it, then let's skip it.


# 8 bit (0b0000 1000) is missles mode
self.current_beam = bcd_to_dec(self.pyboy.memory[0xD04D])

self.current_e_tanks = bcd_to_dec(self.pyboy.memory[0xD050])
self.current_hp = bcd_to_dec(self.pyboy.memory[0xD051])
self.current_full_e_tanks = self.pyboy.memory[0xD052]
self.current_missiles = bcd_to_dec(self.pyboy.memory[0xD053])

# Question mark next to this one on datacrystal
# self.num_sprites_onscreen = self.pyboy.memory[0xD064]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to have this, if we don't use it


self.current_missile_capacity = bcd_to_dec(self.pyboy.memory[0xD081])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the current_ prefix, as it's presumed the attributes are current.


self.displayed_hp = self.pyboy.memory[0xD084]
self.displayed_missiles = bcd_to_dec(self.pyboy.memory[0xD086])
Comment on lines +94 to +95
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would displayed and current HP/missiles be different?

self.global_metroid_count = bcd_to_dec(self.pyboy.memory[0xD09A])
self.local_metroid_count = bcd_to_dec(self.pyboy.memory[0xD0A7])

# TODO calculate health percent using E tank counts (?)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Place the comment right next to the appropriate HP attribute if the comment is still relevant.




def start_game(self, timer_div=None):
"""
Call this function right after initializing PyBoy. This will navigate through menus to start the game at the
first playable state.

The state of the emulator is saved, and using `reset_game`, you can get back to this point of the game
instantly.

Kwargs:
* timer_div (int): Replace timer's DIV register with this value. Use `None` to randomize.
"""

# NOTE, I may be able to make these tick waits shorter
self.pyboy.tick(False)
self.pyboy.button("start")
self.pyboy.tick(300, False)

# start the game
self.pyboy.button("start")
# wait for samus's "blinking" to stop
self.pyboy.tick(500, False)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much shorter can they be made? Should be quick to find out.

PyBoyGameWrapper.start_game(self, timer_div=timer_div)


def reset_game(self, timer_div=None):
"""
After calling `start_game`, you can call this method at any time to reset the game.

Kwargs:
* timer_div (int): Replace timer's DIV register with this value. Use `None` to randomize.
"""
# TODO implement me, I don't know if I really need to do anything here?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine as is. We can remove the comment


self._game_over = False

PyBoyGameWrapper.reset_game(self, timer_div=timer_div)

def game_area(self):
"""
Use this method to get a matrix of the "game area" of the screen.

```text
0 1 2 3 4 5 6 7 8 9
____________________________________________________________________________________
0 | 383 383 383 301 383 383 383 297 383 383 383 301 383 383 383 297 383 383 383 293
1 | 383 383 383 383 300 294 295 296 383 383 383 383 300 294 295 296 383 383 299 383
2 | 311 318 319 320 383 383 383 383 383 383 383 383 383 383 383 383 383 301 383 383
3 | 383 383 383 321 322 383 383 383 383 383 383 383 383 383 383 383 383 383 300 294
4 | 383 383 383 383 323 290 291 383 383 383 313 312 311 318 319 320 383 290 291 383
5 | 383 383 383 383 324 383 383 383 383 315 314 383 383 383 383 321 322 383 383 383
6 | 383 383 383 383 324 293 292 383 383 316 383 383 383 383 383 383 323 383 383 383
7 | 383 383 383 383 324 383 383 298 383 317 383 383 383 383 383 383 324 383 383 383
8 | 319 320 383 383 324 383 383 297 383 317 383 383 383 152 140 383 324 383 383 307
9 | 383 321 322 383 324 294 295 296 383 325 383 383 383 383 383 383 326 272 274 309
10 | 383 383 323 383 326 383 383 383 2 18 383 330 331 331 331 331 331 331 331 331
11 | 274 383 324 272 274 272 274 272 274 272 274 334 328 328 328 328 328 328 328 328
12 | 331 331 331 331 331 331 331 331 331 331 331 328 328 328 328 328 328 328 328 328
13 | 328 328 328 277 278 328 328 328 328 328 328 328 328 277 278 328 328 277 278 277
14 | 328 277 278 279 281 277 278 328 328 277 278 277 278 279 281 277 278 279 281 279
15 | 278 279 281 280 282 279 281 277 278 279 281 279 281 280 282 279 281 280 282 280
```
Comment on lines +147 to +166
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to update this view, as this is copied from Kirby.

Even better, you can make it a test as in the Super Mario Land wrapper (without the mapping):

  >>> pyboy = PyBoy(supermarioland_rom)
  >>> pyboy.game_wrapper.start_game()
  >>> pyboy.game_wrapper.game_area_mapping(pyboy.game_wrapper.mapping_compressed, 0)
  >>> pyboy.game_wrapper.game_area()
  array([[ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0, 13,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0, 14, 14,  0,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [ 0, 14, 14,  0,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0],
         [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10],
         [10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10]], dtype=uint32)


Returns
-------
memoryview:
Simplified 2-dimensional memoryview of the screen
"""
return PyBoyGameWrapper.game_area(self)

def game_over(self):
return self._game_over

def __repr__(self):
# yapf: disable
return (
f"Metroid II:\n" +
# TODO add relevant variables to print for debugging purposes
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the attributes you find relevant

f"XY Pixels: {(self.x_pos_pixels, self.y_pos_pixels)}\n" +
f"XY Area: {(self.x_pos_area, self.y_pos_area)}\n" +
f"Pose: {self.pose}\t" +
f"Facing: {self.samus_facing}\n" +
f"Upgrades: {self.current_major_upgrades}\n" +
f"Water Info: {self.water_info}\n" +
f"Curr Beam: {self.current_beam}\n" +
f"Curr E tanks: {self.current_e_tanks}\n" +
f"Curr HP: {self.current_hp}\n" +
f"Curr Full E Tanks: {self.current_full_e_tanks}\n" +
f"Curr missiles: {self.current_missiles}\n" +
f"Curr missile capacity: {self.current_missile_capacity}\n" +
f"Displayed HP: {self.displayed_hp}\n" +
f"Displayed Missiles: {self.displayed_missiles}\n"+
f"GMC: {self.global_metroid_count}\n" +
f"LMC: {self.global_metroid_count}\n"
# I don't like seeing the huge grid whne trying to develop
# The sprite list can be messy too, since many things (especially
# samus) are composed of multiple sprites, so simply running causes
# the output to constantly change "shape", making it very difficult
# to read
# super().__repr__()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although I understand, please add it back in, so each game wrapper follows the same structure.

)
# yapf: enable
3 changes: 3 additions & 0 deletions pyboy/plugins/manager.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ from pyboy.plugins.game_wrapper_tetris cimport GameWrapperTetris
from pyboy.plugins.game_wrapper_kirby_dream_land cimport GameWrapperKirbyDreamLand
from pyboy.plugins.game_wrapper_pokemon_gen1 cimport GameWrapperPokemonGen1
from pyboy.plugins.game_wrapper_pokemon_pinball cimport GameWrapperPokemonPinball
from pyboy.plugins.game_wrapper_metroid_ii cimport GameWrapperMetroidII
# imports end


Expand All @@ -48,6 +49,7 @@ cdef class PluginManager:
cdef public GameWrapperKirbyDreamLand game_wrapper_kirby_dream_land
cdef public GameWrapperPokemonGen1 game_wrapper_pokemon_gen1
cdef public GameWrapperPokemonPinball game_wrapper_pokemon_pinball
cdef public GameWrapperMetroidII game_wrapper_metroid_ii
cdef bint window_sdl2_enabled
cdef bint window_open_gl_enabled
cdef bint window_null_enabled
Expand All @@ -64,6 +66,7 @@ cdef class PluginManager:
cdef bint game_wrapper_kirby_dream_land_enabled
cdef bint game_wrapper_pokemon_gen1_enabled
cdef bint game_wrapper_pokemon_pinball_enabled
cdef bint game_wrapper_metroid_ii_enabled
# plugin_cdef end

cdef list handle_events(self, list) noexcept
Expand Down
13 changes: 13 additions & 0 deletions pyboy/plugins/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from pyboy.plugins.game_wrapper_kirby_dream_land import GameWrapperKirbyDreamLand # isort:skip
from pyboy.plugins.game_wrapper_pokemon_gen1 import GameWrapperPokemonGen1 # isort:skip
from pyboy.plugins.game_wrapper_pokemon_pinball import GameWrapperPokemonPinball # isort:skip
from pyboy.plugins.game_wrapper_metroid_ii import GameWrapperMetroidII # isort:skip
# imports end


Expand All @@ -43,6 +44,7 @@ def parser_arguments():
yield GameWrapperKirbyDreamLand.argv
yield GameWrapperPokemonGen1.argv
yield GameWrapperPokemonPinball.argv
yield GameWrapperMetroidII.argv
# yield_plugins end
pass

Expand Down Expand Up @@ -86,6 +88,8 @@ def __init__(self, pyboy, mb, pyboy_argv):
self.game_wrapper_pokemon_gen1_enabled = self.game_wrapper_pokemon_gen1.enabled()
self.game_wrapper_pokemon_pinball = GameWrapperPokemonPinball(pyboy, mb, pyboy_argv)
self.game_wrapper_pokemon_pinball_enabled = self.game_wrapper_pokemon_pinball.enabled()
self.game_wrapper_metroid_ii = GameWrapperMetroidII(pyboy, mb, pyboy_argv)
self.game_wrapper_metroid_ii_enabled = self.game_wrapper_metroid_ii.enabled()
# plugins_enabled end

def gamewrapper(self):
Expand All @@ -95,6 +99,7 @@ def gamewrapper(self):
if self.game_wrapper_kirby_dream_land_enabled: return self.game_wrapper_kirby_dream_land
if self.game_wrapper_pokemon_gen1_enabled: return self.game_wrapper_pokemon_gen1
if self.game_wrapper_pokemon_pinball_enabled: return self.game_wrapper_pokemon_pinball
if self.game_wrapper_metroid_ii_enabled: return self.game_wrapper_metroid_ii
# gamewrapper end
self.generic_game_wrapper_enabled = True
return self.generic_game_wrapper
Expand Down Expand Up @@ -135,6 +140,8 @@ def handle_events(self, events):
events = self.game_wrapper_pokemon_gen1.handle_events(events)
if self.game_wrapper_pokemon_pinball_enabled:
events = self.game_wrapper_pokemon_pinball.handle_events(events)
if self.game_wrapper_metroid_ii_enabled:
events = self.game_wrapper_metroid_ii.handle_events(events)
# foreach end
if self.generic_game_wrapper_enabled:
events = self.generic_game_wrapper.handle_events(events)
Expand Down Expand Up @@ -166,6 +173,8 @@ def post_tick(self):
self.game_wrapper_pokemon_gen1.post_tick()
if self.game_wrapper_pokemon_pinball_enabled:
self.game_wrapper_pokemon_pinball.post_tick()
if self.game_wrapper_metroid_ii_enabled:
self.game_wrapper_metroid_ii.post_tick()
# foreach end
if self.generic_game_wrapper_enabled:
self.generic_game_wrapper.post_tick()
Expand Down Expand Up @@ -253,6 +262,8 @@ def window_title(self):
title += self.game_wrapper_pokemon_gen1.window_title()
if self.game_wrapper_pokemon_pinball_enabled:
title += self.game_wrapper_pokemon_pinball.window_title()
if self.game_wrapper_metroid_ii_enabled:
title += self.game_wrapper_metroid_ii.window_title()
# foreach end
return title

Expand Down Expand Up @@ -292,6 +303,8 @@ def stop(self):
self.game_wrapper_pokemon_gen1.stop()
if self.game_wrapper_pokemon_pinball_enabled:
self.game_wrapper_pokemon_pinball.stop()
if self.game_wrapper_metroid_ii_enabled:
self.game_wrapper_metroid_ii.stop()
# foreach end
if self.generic_game_wrapper_enabled:
self.generic_game_wrapper.stop()
Expand Down
2 changes: 1 addition & 1 deletion pyboy/plugins/manager_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
windows = ["WindowSDL2", "WindowOpenGL", "WindowNull", "Debug"]
game_wrappers = [
"GameWrapperSuperMarioLand", "GameWrapperTetris", "GameWrapperKirbyDreamLand", "GameWrapperPokemonGen1",
"GameWrapperPokemonPinball"
"GameWrapperPokemonPinball", "GameWrapperMetroidII"
]
plugins = [
"DisableInput", "AutoPause", "RecordReplay", "Rewind", "ScreenRecorder", "ScreenshotRecorder", "DebugPrompt"
Expand Down
Loading