at67 emulator

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

Re: at67 emulator

Post by at67 »

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 »

Thank you for your answer. I tried on my ubuntu+nvidia the settings you suggested, but with no success unfortunately.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: at67 emulator

Post by at67 »

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 »

it works on linux ! thank you.
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: at67 emulator

Post by at67 »

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: 488
Joined: 13 May 2018, 08:26

Re: at67 emulator

Post by marcelk »

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
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: at67 emulator

Post by at67 »

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"
dwesti
Posts: 15
Joined: 31 Jan 2020, 05:37

Re: at67 emulator

Post by dwesti »

thank you for sharing at67.
can anyone compile gtasm.exe for win3 please?
at67
Site Admin
Posts: 647
Joined: 14 May 2018, 08:29

Re: at67 emulator

Post by at67 »

dwesti wrote: 31 Jan 2020, 05:41 can anyone compile gtasm.exe for win3 please?

I'm assuming you meant Win32? If you really mean Windows 3.0 then it's not possible, gtemu67 requires a modern C++ with a modern version of the STL.

You can download the free version of Visual Studio Express for Windows and trivially build it yourself, it's also buildable under Linux and MacOS.

It's in your best interest to build it yourself, as it's an extreme security risk accepting unknown executables from the internets; I'm also regularly updating the source code every couple of days and thus whatever executable you receive will quickly become stale.

If you require help in getting it built, just ask away in this thread and I'll do my best to get you sorted.
dwesti
Posts: 15
Joined: 31 Jan 2020, 05:37

Re: at67 emulator

Post by dwesti »

I meant 32bit build for windows.

Visual Studio Express not workin on my computer:(
Post Reply