dciabrin / ngdevkit

Open source development for Neo-Geo
GNU Lesser General Public License v3.0
262 stars 26 forks source link

run example : pygame.error: File is not a Windows BMP file #46

Closed qllbee closed 3 years ago

qllbee commented 3 years ago

MAC mojave 10.14 I follow the tutorial, I downloaded nightly-202101221736.zip autoreconf -iv ./configure --prefix=$PWD/local make or gmake,I both tried... afer half an hour,everthing seems finished, make install cd examples ./configure make or gmake,I both tried... error report: pygame.error: File is not a Windows BMP file

:( I'm a rookie. I'm ##stuck......

bogon:examples fanta$ gmake for i in 01-helloworld 02-sprite 03-sprite-animation 04-palette 05-scrolling 06-sound-adpcma 07-attract-and-game 08-software-dips 09-horizontal-sync; do gmake -C $i cart nullbios || exit 1; done gmake[1]: Entering directory '/Users/fanta/Downloads/ngdevkit-nightly-202101221736/examples/01-helloworld' gmake -C ../assets gmake[2]: Entering directory '/Users/fanta/Downloads/ngdevkit-nightly-202101221736/examples/assets' ./build-srom.py -s smalltext-shadow.png -t talltext-shadow.png -b talltext.png -o srom-shadow.bmp Traceback (most recent call last): File "/Users/fanta/Downloads/ngdevkit-nightly-202101221736/examples/assets/./build-srom.py", line 108, in main() File "/Users/fanta/Downloads/ngdevkit-nightly-202101221736/examples/assets/./build-srom.py", line 81, in main smalltxt = pygame.image.load(arguments.small) pygame.error: File is not a Windows BMP file gmake[2]: [Makefile:37: srom-shadow.bmp] Error 1 gmake[2]: Leaving directory '/Users/fanta/Downloads/ngdevkit-nightly-202101221736/examples/assets' gmake[1]: [Makefile:30: ../assets/rom/c1.bin] Error 2 gmake[1]: Leaving directory '/Users/fanta/Downloads/ngdevkit-nightly-202101221736/examples/01-helloworld' gmake: *** [Makefile:31: all] Error 1 bogon:examples fanta$

dciabrin commented 3 years ago

Hmmm you may have installed a version of pygame that wasn't built with support for png [1], so by default it reverts to parsing BMP files only.

On my env, a fresh "brew install pygame" installs a version of pygame with SDL2, and the right SDL_image library:

$ pip3 install pygame
Collecting pygame
  Downloading https://files.pythonhosted.org/packages/3a/40/69eebf7145055f51cc90145e547da2b68c454b61ae5df6648fec6a259b2f/pygame-2.0.1-cp38-cp38-macosx_10_9_intel.whl (6.9MB)
     |████████████████████████████████| 6.9MB 3.7MB/s 
Installing collected packages: pygame
Successfully installed pygame-2.0.1
WARNING: You are using pip version 19.2.3, however version 21.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

$ python3
Python 3.8.1 (v3.8.1:1b293b6006, Dec 18 2019, 14:08:53) 
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 2.0.1 (SDL 2.0.14, Python 3.8.1)
Hello from the pygame community. https://www.pygame.org/contribute.html
>>> pygame.image.load("smalltext.png")
<Surface(1024x8x8 SW)>

Can you check what your env is returning?

[1] https://www.pygame.org/docs/ref/image.html#pygame.image.load

qllbee commented 3 years ago

Last login: Sat Jan 30 04:15:53 on ttys001 bogon:gfx fanta$ cd .. bogon:assets fanta$ python3 Python 3.9.1 (default, Jan 8 2021, 17:15:36) [Clang 11.0.0 (clang-1100.0.33.17)] on darwin Type "help", "copyright", "credits" or "license" for more information.

import pygame pygame 2.0.0.dev6 (SDL 2.0.14, python 3.9.1) Hello from the pygame community. https://www.pygame.org/contribute.html pygame.image.load("smalltext.png") Traceback (most recent call last): File "", line 1, in pygame.error: File is not a Windows BMP file

dciabrin commented 3 years ago

OK that's an old version, I should update the README. Since end of last year, pygame now defaults to SDL2 on PyPI.

Could you try to remove it and reinstall the latest from PyPI?

pip3 uninstall pygame
pip3 install pygame

That should give you the same version that I have reported in the comment above, that one should work.

qllbee commented 3 years ago

yes!thank you!everything OK! test :example 01 ok 02 ok There are only a few (2) small flaws: 1 cd example make ... ... ys;open(sys.argv[3],"a").truncate(int(sys.argv[2]))' -s 131072 rom/202-s1.s1 mkdir samples V1 sfx/woosh.mp3 -c 1 -r 18500 samples/woosh.wav silence 1 0.01 0.1% reverse silence 1 0.07 1% reverse make[1]: V1: No such file or directory make[1]: [Makefile:59: samples/woosh.wav] Error 127 (ignored) /usr/local/Cellar/ngdevkit/0.2+202101221736-1/bin/adpcmtool.py -e samples/woosh.wav -o samples/woosh.adpcma -v Trying to encode input file samples/woosh.wav error: samples/woosh.wav does not exist make[1]: [Makefile:66: samples/woosh.adpcma] Error 1 make[1]: Leaving directory '/Users/fanta/Downloads/ngdevkit-nightly-202101221736/examples/06-sound-adpcma' make: [Makefile:31: all] Error 1 bogon:examples fanta$ --------woosh.wav does not exist---------------- 2 cd 01-helloworld make clean make gngeo nothing happened....!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! no romelf no rom/ no...

make cp rom/puzzledp.zip /usr/local/share/gngeo/ # I set rompath at gngeorc gngeo puzzledp game running~~

dciabrin commented 3 years ago

The first error probably means sox is not installed on your system, it should be resolved with:

brew install sox

And by re-running ./configure in the example directory. Look for the generated makefile Makefile.config, it should contain:

SOX=/usr/local/bin/sox

The second error is a makefile shortcoming. the target make neogeo doesn't try to build the rom. You have to manually do make && make gngeo to run the emulator. I'll try to fix that in a subsequent commit in ngdevkit-examples.

qllbee commented 3 years ago

thank you very much and thank this neogeo-dev,I'm no a programmer,but I'm a snk fans,neogeo fans.I have aes mvs and games and etc...

the second mistake made me laugh, I just copy your toturial command.....I'm a donkey

https://github.com/dciabrin/ngdevkit Running the emulator Once you have built the examples, go into a subdirectory to test the compiled example and run GnGeo from the makefile: cd examples/01-helloworld make gngeo ### # next time, I try not to be stupid

or run "make gngeo-fullscreen" for a more immersive test

qllbee commented 3 years ago

you should also fix this: https://github.com/dciabrin/ngdevkit pip3 install pygame==2.0.0.dev6

or need... pip3 uninstall pygame pip3 install pygame

qllbee commented 3 years ago

fantadeiMac:01-helloworld fanta$ ls Makefile main.c fantadeiMac:01-helloworld fanta$ make ... cp /usr/local/Cellar/ngdevkit/0.2+202101221736-1/share/ngdevkit/neogeo.zip rom

fantadeiMac:01-helloworld fanta$ ls rom 202-c1.bin 202-c2.bin 202-m1.bin 202-p1.bin 202-s1.bin 202-v1.bin neogeo.zip 202-c1.c1 202-c2.c2 202-m1.m1 202-p1.p1 202-s1.s1 202-v1.v1 puzzledp.zip fantadeiMac:01-helloworld fanta$ make gngeo ...

Default roms init Allocating 0x00001000 byte for Region 10 Readed=131072 Load Sfix Couldn't find sfix.sfx, try sfix.sfix Readed=131072 Can't load puzzledp Can't init puzzledp...

I still have to manually do: cp rom/puzzledp.zip /usr/local/share/gngeo/ gngeo puzzledp

qllbee commented 3 years ago

make I see this log: cp /usr/local/Cellar/ngdevkit/0.2+202101221736-1/share/ngdevkit/neogeo.zip rom

cp my-neogeo.zip /usr/local/Cellar/ngdevkit/0.2+202101221736-1/share/ngdevkit/neogeo.zip make clean make mak gngeo it work!

I'm a little confused, since neogeo.zip has been replaced with my-original bios, why still shows ngdevkit-bios

another question, How to skip the BIOS screen and display the game screen directly when testing?

qllbee commented 3 years ago

I got it,build my srom.