Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add gameShark api #341

Closed
wants to merge 1 commit into from
Closed

Conversation

daivikbhatia
Copy link

@daivikbhatia daivikbhatia commented Sep 7, 2024

#286 Added support for GameShark API

  • Created two new files in the API directory: gameshark.py and gameshark.pdx.
  • Added a run_cheats() function that can be called from PyBoy using pyboy.gameshark.run_cheats(cheat, _is_path).
  • Introduced an _is_path flag in the run_cheats() function:
    • If _is_path is True, cheat must be a path to a text file containing cheats.
    • If _is_path is False, cheat can be passed directly as a string.

Example Usage:

from pyboy import PyBoy
pyboy = PyBoy("./red.gb")
while pyboy.tick():
    pyboy.gameshark.run_cheats("010138CD",_is_path=False)
    pass
pyboy.stop()

@Baekalfen
Copy link
Owner

Is the cheats file a commonly used format for GameShark cheats?

Otherwise, I'm thinking to just have the API apply one at a time from a string (_is_path=False) and remove this complexity. The end-user can easily implement this on their own.

@Baekalfen
Copy link
Owner

Also, I don't use these cheats myself. Could you add a tests/test_gameshark.py?

@daivikbhatia
Copy link
Author

Is the cheats file a commonly used format for GameShark cheats?

Otherwise, I'm thinking to just have the API apply one at a time from a string (_is_path=False) and remove this complexity. The end-user can easily implement this on their own.

The cheat file is not commonly used. Usually cheats are entered from the emulator interface iteself. I kept cheat file option because it was their in codebase I referred. It would totally make sense to remove it and have the string functionality only.
I will remove it.

@Baekalfen
Copy link
Owner

Superseded by #345. Thank you so much for the initial work! It's still the basis of the other PR.

@Baekalfen Baekalfen closed this Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants