at67 emulator

Using, learning, programming and modding the Gigatron and anything related.
Forum rules
Be nice.
at67
Posts: 63
Joined: 14 May 2018, 08:29

Re: at67 emulator

Post by at67 » 31 Dec 2018, 21:33

A quick Google has come up with the following possible solutions, (should be applicable to OSX as well):

Code: Select all

export DISPLAY=:0
export SDL_VIDEODRIVER=x11
P.S. You may need one or both of these.

wawachief
Posts: 3
Joined: 31 Dec 2018, 10:12

Re: at67 emulator

Post by wawachief » 03 Jan 2019, 18:45

Thank you for your answer. I tried on my ubuntu+nvidia the settings you suggested, but with no success unfortunately.

at67
Posts: 63
Joined: 14 May 2018, 08:29

Re: at67 emulator

Post by at67 » 05 Jan 2019, 00:27

This might solve the problem, (and for OSX as well).

Try replacing the following code in graphics.cpp at line 302 to 342

Code: Select all

        // Screen texture
        _screenTexture = SDL_CreateTexture(_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, SCREEN_WIDTH, SCREEN_HEIGHT);
        if(_screenTexture == NULL)
        {
            SDL_Quit();
            fprintf(stderr, "Graphics::initialise() :  failed to create SDL texture.\n");
            _EXIT_(EXIT_FAILURE);
        }

        // Screen surface
        _screenSurface = SDL_GetWindowSurface(_window);
        if(_screenSurface == NULL)
        {
            SDL_Quit();
            fprintf(stderr, "Graphics::initialise() :  failed to create SDL surface.\n");
            _EXIT_(EXIT_FAILURE);
        }

#ifdef CREATE_FONT_HEADER
        // Load font file
        SDL_Surface* fontSurface = SDL_LoadBMP("EmuFont-96x48.bmp");
        if(fontSurface == NULL)
        {
            SDL_Quit();
            fprintf(stderr, "Graphics::initialise() : failed to create SDL font surface, you're probably missing 'EmuFont-96x48.bmp' in the current directory/path.\n");
            _EXIT_(EXIT_FAILURE);
        }
        _fontSurface = SDL_ConvertSurfaceFormat(fontSurface, _screenSurface->format->format, NULL);
        SDL_FreeSurface(fontSurface);
        if(_fontSurface == NULL)
        {
            SDL_Quit();
            fprintf(stderr, "Graphics::initialise() : failed to convert SDL font surface format to screen surface format.\n");
            _EXIT_(EXIT_FAILURE);
        }
        // Use this if you want to change the default font
        createFontHeader(_fontSurface, "emuFont96x48.h", "_emuFont96x48", FONT_BMP_WIDTH, FONT_BMP_HEIGHT);
#else
        _fontSurface = createSurface(FONT_BMP_WIDTH, FONT_BMP_HEIGHT);
        writeToSurface(_fontSurface, _emuFont96x48, FONT_BMP_WIDTH, FONT_BMP_HEIGHT);
#endif
with this and recompile.

Code: Select all

        // Screen texture
        _screenTexture = SDL_CreateTexture(_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, SCREEN_WIDTH, SCREEN_HEIGHT);
        if(_screenTexture == NULL)
        {
            SDL_Quit();
            fprintf(stderr, "Graphics::initialise() :  failed to create SDL texture.\n");
            _EXIT_(EXIT_FAILURE);
        }

#ifdef CREATE_FONT_HEADER
        // Screen surface
        _screenSurface = SDL_GetWindowSurface(_window);
        if(_screenSurface == NULL)
        {
            SDL_Quit();
            fprintf(stderr, "Graphics::initialise() :  failed to create SDL surface.\n");
            _EXIT_(EXIT_FAILURE);
        }

        // Load font file
        SDL_Surface* fontSurface = SDL_LoadBMP("EmuFont-96x48.bmp");
        if(fontSurface == NULL)
        {
            SDL_Quit();
            fprintf(stderr, "Graphics::initialise() : failed to create SDL font surface, you're probably missing 'EmuFont-96x48.bmp' in the current directory/path.\n");
            _EXIT_(EXIT_FAILURE);
        }
        _fontSurface = SDL_ConvertSurfaceFormat(fontSurface, _screenSurface->format->format, NULL);
        SDL_FreeSurface(fontSurface);
        if(_fontSurface == NULL)
        {
            SDL_Quit();
            fprintf(stderr, "Graphics::initialise() : failed to convert SDL font surface format to screen surface format.\n");
            _EXIT_(EXIT_FAILURE);
        }
        // Use this if you want to change the default font
        createFontHeader(_fontSurface, "emuFont96x48.h", "_emuFont96x48", FONT_BMP_WIDTH, FONT_BMP_HEIGHT);
#else
        _fontSurface = createSurface(FONT_BMP_WIDTH, FONT_BMP_HEIGHT);
        writeToSurface(_fontSurface, _emuFont96x48, FONT_BMP_WIDTH, FONT_BMP_HEIGHT);
#endif
If you do get a chance to try it could you report back here, cheers.

wawachief
Posts: 3
Joined: 31 Dec 2018, 10:12

Re: at67 emulator

Post by wawachief » 06 Jan 2019, 08:01

it works on linux ! thank you.

at67
Posts: 63
Joined: 14 May 2018, 08:29

Re: at67 emulator

Post by at67 » 06 Jan 2019, 11:08

Good stuff, I figured that the problem is that DirectX/Windows is much more lenient in locking unlockable surfaces, (driver dependent of course), so I removed that code, (it's not strictly needed anyway).

The same code change *should* work for the OSX crowd, I'll push that fix and some recent updates in the next few days. But if one of the OSX guys wants to try the change as well, it would be appreciated.

User avatar
marcelk
Posts: 178
Joined: 13 May 2018, 08:26

Re: at67 emulator

Post by marcelk » 06 Jan 2019, 16:41

2018 MacBook Pro, 16GB, 2.7GHz Core i7, Intel graphics chip.

There are compile warnings but I get it running now in a resizable window with borders. Looks great. I can move the cursor on the right side of the screen and edit values. 'H' shows the help menu and I can use 'F1' to reset the emulation. 'F11' moves the entire window out of view however. (I think that is an OS function.) The 'WASD' keys move the Gigatron flashy arrow and I managed to play some Snake. It sometimes freezes, and then 'ESC' also doesn't exit. I have to kill the window. I don't know what triggers it, it seems to happen when I'm browsing the file system after 'L', not sure. I also turn the sound off because of static noise (loud ticks, sometimes machine gun like).

Overall, great progress! I can put the EeePC back to where it came from :-)

at67
Posts: 63
Joined: 14 May 2018, 08:29

Re: at67 emulator

Post by at67 » 07 Jan 2019, 10:06

Hmm some strange symptoms there.

WRT to keyboard issues most if not all the keys are re-definable, just edit "input_config.ini", (there's an example one in the repo).

I'm still yet to try an OSX VM, so that will be my next experiment.

P.S. If you try to use the CTRL + <key> versions of some commands to talk to real hardware then you have to have a valid path to the GCL tools in a valid repo directory structure within "loader_config.ini"

Post Reply