Error when trying to run with color palette
jelleholtkamp opened this issue · 7 comments
I'm getting an error while trying to start PyBoy with a color_palette. I'm trying to run it like this:
session = PyBoy(filename, window_type="headless" if quiet else "SDL2", scale=6, debug=quiet, color_palette="FFFFFF,999999,555555,000000")
I am getting the following errors:
Traceback (most recent call last):
File "[filepath]\src\main.py", line 21, in <module>
session = PyBoy(filename, window_type="headless" if quiet else "SDL2", scale=6, debug=quiet, color_palette="FFFFFF,999999,555555,000000")
File "pyboy\pyboy.py", line 82, in pyboy.pyboy.PyBoy.__init__
File "pyboy\core\mb.py", line 56, in pyboy.core.mb.Motherboard.__init__
File "pyboy\core\lcd.py", line 78, in pyboy.core.lcd.LCD.__init__
TypeError: unsupported operand type(s) for <<: 'str' and 'int'
The same command runs fine without the color palette.
When I try to run with a color palette like this I get no errors, but it's still black/white:
pyboy.exe "[filepath]CPPRed\Roms\Red.gb" --color-palette "FFFFFF,999999,555555,000000"
I'm running Pokemon Red
Try with PyBoy(..., color_palette=(0xFFFFFF,0x999999,0x555555,0x000000))
Nope, still black and white unfortunately.
Could you paste exactly what you're trying?
import src.classes.PokemonData as PokemonData
import src.classes.Commands as Commands
import src.classes.GameData as GameData
import src.classes.ComputerVision as ComputerVision
import os
import sys
import logging
from pyboy import PyBoy, WindowEvent
logging.basicConfig(stream=sys.stderr, level=logging.INFO)
# Makes us able to import PyBoy from the directory below
file_path = os.path.dirname(os.path.realpath(__file__))
sys.path.insert(0, file_path + "/..")
# Check if the ROM is given through argv
if len(sys.argv) > 1:
filename = sys.argv[1]
else:
print("Usage: Test.py [ROM file]")
exit(1)
quiet = "--quiet" in sys.argv
session = PyBoy(filename, window_type="headless" if quiet else "SDL2", scale=6, debug=quiet, sound=True, color_palette=(0xFFFFFF,0x999999,0x555555,0x000000))
session.set_emulation_speed(0)
assert session.cartridge_title() == "POKEMON RED"
startGame = Commands.StartGame()
startGame.Start(session)
while not session.tick():
result = Commands.Dialog.PC(session)
if result != None:
print(result)
for i in range(0, 500):
session.tick()
session.stop()
0xFFFFFF,0x999999,0x555555,0x000000
You need to modify these if you want colors. Try: 0xFFFF00,0x990099,0x005555,0x000000
. You'll need to define the colors you'd like.
Yeah I figured that and already tried some randomly figuring I should see some change but to no avail. However the one you sent does work. I'm guessing it only supports certain ranges which makes sense now that I think about it. I found a list with color patterns that matched the ones the original game boy color supported, so I'll experiment with those. Thank you!
I'm guessing it only supports certain ranges
It supports any colors you'd like.