mark.warren
2019-2-18 13:17:51

@andreiformiga After you gave me that ffi example with sdl I started to get interested in doing some sdl myself. It was going fine until I implemented SDL_LoadBMP. I get an error (The specified procedure could not be found.; errid=127) . Have you had this problem? Any ideas?


andreiformiga
2019-2-18 13:22:38

@mark.warren I don’t remember having this issue. If it’s any help, my code is here: https://github.com/tautologico/rasdel


andreiformiga
2019-2-18 13:22:59

In the examples dir there’s a program that loads bmp


mark.warren
2019-2-18 13:23:16

@andreiformiga Thanks I’ll take a look, probably something basic.


mark.warren
2019-2-18 13:28:15

@andreiformiga Looks like you are using SDL_LoadBMP_RW not SDL_LoadBMP. Maybe SDL_LoadBMP is obsolete.


andreiformiga
2019-2-18 13:31:43

I think I used the RW form because it’s more versatile, I don’t remember exactly


mark.warren
2019-2-18 13:33:00

Fair enough.


andreiformiga
2019-2-18 13:36:47

my plan was to release this as a package eventually. part of the code is based on the racket-sdl package but it was not working properly and I changed bindings to the functions I used to improve their interface (at least for my tastes)


mark.warren
2019-2-18 13:37:52

Looks good. I’m just playing. Trying to improve my knowledge of ffi.


andreiformiga
2019-2-18 13:41:13

@mark.warren here is a Coleco Vision emulator (incomplete, no sound yet etc) that uses this code: https://www.youtube.com/watch?v=gj-7rGGjT8I


mark.warren
2019-2-18 13:42:29

@andreiformiga That’s very cool.


andreiformiga
2019-2-18 13:43:03

you can see many bugs in this video, I have to clear some time to debug Z80 code :slightly_smiling_face:


mark.warren
2019-2-18 13:44:27

All part of the fun :grin:


andreiformiga
2019-2-18 13:47:56

right now it’s all racket code, except for the SDL of course


mark.warren
2019-2-18 13:48:58

Is it a full Z80 emulator?


andreiformiga
2019-2-18 13:52:33

Yes. Passes all but one of the ZEXALL tests


andreiformiga
2019-2-18 13:53:35

There are a few details missing but it emulates the Coleco Vision and MSX computers


andreiformiga
2019-2-18 13:54:57

Probably other hardware too but I only have the video chip working for these two :grinning:


mark.warren
2019-2-18 13:58:21

Sweet


mark.warren
2019-2-18 14:02:11

@andreiformiga Aha! Found out why SDL_LoadBMP is a macro for SDL_LoadBMP_RW. Should have looked in the header file first #define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1)


andreiformiga
2019-2-18 14:20:58

oh right, I think that was the reason :slightly_smiling_face:


mark.warren
2019-2-18 14:23:57

:grin: You don’t close the file in the example, is that not necessary? Because RWClose is a macro to close which is not in sdl.


andreiformiga
2019-2-18 14:24:32

I think it would be better to close the file :slightly_smiling_face:


mark.warren
2019-2-18 14:25:07

Probably


andreiformiga
2019-2-18 14:25:53

I’m not sure but I think that loading from a file in one call does not leave the file open


mark.warren
2019-2-18 14:26:16

I’ll check that


andreiformiga
2019-2-18 14:26:34

The RW functions in SDL are a kind of generic facility for streams


andreiformiga
2019-2-18 14:27:21

maybe RWClose is to be used with streams that you open… in the case of loading the image from a file the stream is opened and closed internally… I think. Better check that


mark.warren
2019-2-18 14:28:19

Cheers, will do