stardot / beebem-windows

BBC micro emulator for Windows
http://www.mkw.me.uk/beebem/
Other
87 stars 34 forks source link

Crash on start-up after fresh install of 415b1 feb12 #35

Open richard-broadhurst opened 6 years ago

richard-broadhurst commented 6 years ago

Beebem crashes on startup at end of install and trying to run beebem afterwards. I've built it locally with VS2017, I only have 6, 12, 13 and 17. To build it from the .sln, I had to:

define WIN32 (the code deos #ifdef WIN32 #include , but windows.h is what is supposed to #define WIN32, it would be better to #ifdef _WIN32, which is supported by MSVC and gcc.

define _CRT_SECURE_NO_WARNINGS to remove the warnings (or replace all the function calls).

Swap the character set to multi-byte instead of unicode (I always do this anyway!) I'm now seeing that the error is that m_DD2 is null in UpdateSmoothing, I suspect that this is because the config file has smoothing enabled, but beebem is not using DX as I have seen this bug in earlier versions.

richard-broadhurst commented 6 years ago

I've added an if (m_DD2) to the else in BeebWin::UpdateSmoothingwhich seems to have solved the immediate issue. void BeebWin::UpdateSmoothing(void) { DDSURFACEDESC ddsd; HRESULT ddrval;

if (m_DisplayRenderer == IDM_DISPDX9)
{
    if (m_DXSmoothing && (!m_DXSmoothMode7Only || TeletextEnabled))
    {
        // Turn on bilinear interpolation so image is smoothed
        m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR );
        m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR );
    }
    else
    {
        // Turn off bilinear interpolation
        m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MINFILTER, D3DTEXF_POINT );
        m_pd3dDevice->SetSamplerState( 0, D3DSAMP_MAGFILTER, D3DTEXF_POINT );
    }
}
else **if (m_DD2)**
richard-broadhurst commented 6 years ago

PS Forgot to mention that I also had to add an additional include path of: $(DXSDK_DIR)include

chrisn commented 6 years ago

Thanks Richard, will take a look. I'm using VS2015 to work on BeebEm. All the project setup stuff (MBCS, _CRT_SECURE_NO_WARNINGS and whatnot) should be ok. I haven't tried VS2017 yet.

richard-broadhurst commented 6 years ago

Just noticed that the defines were there in the 32 bit build, but it would still make sense to use _WIN32 (meaning 32 or 64 bit windows)

richard-broadhurst commented 6 years ago

Also just noticed your reply above, sorry, I hadn't realised that I was building the 64bit build before posting. I skipped 2015, as I found it too slow on my Core2 QUAD.

richard-broadhurst commented 6 years ago

I see that you can no longer select smoothing after choosing GDI, this is good, but I think the settings got confused as I sometimes run old games that use 16bit resolutions and beebem falls back to GDI; but I don't think that it turns smoothing off (or didn't anyway).

chrisn commented 6 years ago

The crash on start-up happens if you have GDI rendering selected and the "Smooth Teletext Mode Only" option enabled.

But, it also seems that smoothing is only switchable when you use the DirectX9 option, not DirectDraw. With DirectDraw, it seems to be always enabled, regardless of the "DirectX Smoothing" and "Smooth Teletext Mode Only" menu settings.