diff --git a/src/win/win_d3d.cpp b/src/win/win_d3d.cpp index c662e3c92..9e367fb71 100644 --- a/src/win/win_d3d.cpp +++ b/src/win/win_d3d.cpp @@ -8,7 +8,7 @@ * * Rendering module for Microsoft Direct3D 9. * - * Version: @(#)win_d3d.cpp 1.0.7 2017/12/13 + * Version: @(#)win_d3d.cpp 1.0.8 2017/12/15 * * Authors: Sarah Walker, * Miran Grca, @@ -144,7 +144,7 @@ d3d_blit_fs(int x, int y, int y1, int y2, int w, int h) hr = d3dTexture->LockRect(0, &dr, &lock_rect, 0); if (hr == D3D_OK) { for (yy = y1; yy < y2; yy++) - memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4); + if (buffer32) memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4); video_blit_complete(); d3dTexture->UnlockRect(0); @@ -248,8 +248,9 @@ d3d_blit(int x, int y, int y1, int y2, int w, int h) hr = d3dTexture->LockRect(0, &dr, &r, 0); if (hr == D3D_OK) { for (yy = y1; yy < y2; yy++) { - if ((y + yy) >= 0 && (y + yy) < buffer32->h) - memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4); + if (buffer32) + if ((y + yy) >= 0 && (y + yy) < buffer32->h) + memcpy((void *)((uintptr_t)dr.pBits + ((yy - y1) * dr.Pitch)), &(((uint32_t *)buffer32->line[yy + y])[x]), w * 4); } video_blit_complete(); diff --git a/src/win/win_ddraw.cpp b/src/win/win_ddraw.cpp index 55923b06d..10d908127 100644 --- a/src/win/win_ddraw.cpp +++ b/src/win/win_ddraw.cpp @@ -11,7 +11,7 @@ * NOTES: This code should be re-merged into a single init() with a * 'fullscreen' argument, indicating FS mode is requested. * - * Version: @(#)win_ddraw.cpp 1.0.2 2017/11/25 + * Version: @(#)win_ddraw.cpp 1.0.3 2017/12/15 * * Authors: Sarah Walker, * Miran Grca, @@ -245,7 +245,7 @@ ddraw_blit_fs(int x, int y, int y1, int y2, int w, int h) } for (yy = y1; yy < y2; yy++) - memcpy((void *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch)), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4); + if (buffer32) memcpy((void *)((uintptr_t)ddsd.lpSurface + (yy * ddsd.lPitch)), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4); video_blit_complete(); lpdds_back->Unlock(NULL); @@ -317,8 +317,9 @@ ddraw_blit(int x, int y, int y1, int y2, int w, int h) } for (yy = y1; yy < y2; yy++) { - if ((y + yy) >= 0 && (y + yy) < buffer->h) - memcpy((uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4); + if (buffer32) + if ((y + yy) >= 0 && (y + yy) < buffer32->h) + memcpy((uint32_t *) &(((uint8_t *) ddsd.lpSurface)[yy * ddsd.lPitch]), &(((uint32_t *)buffer32->line[y + yy])[x]), w * 4); } video_blit_complete(); lpdds_back->Unlock(NULL); diff --git a/src/win/win_ui.c b/src/win/win_ui.c index 159b69207..ccb118b4b 100644 --- a/src/win/win_ui.c +++ b/src/win/win_ui.c @@ -8,7 +8,7 @@ * * user Interface module for WinAPI on Windows. * - * Version: @(#)win_ui.c 1.0.7 2017/12/09 + * Version: @(#)win_ui.c 1.0.8 2017/12/15 * * Authors: Sarah Walker, * Miran Grca, @@ -756,6 +756,16 @@ ui_init(int nCmdShow) 0, 0, 1, 1, hwnd, NULL, hinstance, NULL); MoveWindow(hwndRender, 0, 0, scrnsz_x, scrnsz_y, TRUE); + /* All done, fire up the actual emulated machine. */ + if (! pc_init_modules()) { + /* Dang, no ROMs found at all! */ + MessageBox(hwnd, + plat_get_string(IDS_2056), + plat_get_string(IDS_2050), + MB_OK | MB_ICONERROR); + return(6); + } + /* Initialize the configured Video API. */ if (! plat_setvid(vid_api)) { MessageBox(hwnd, @@ -772,16 +782,6 @@ ui_init(int nCmdShow) /* Set up the current window size. */ plat_resize(scrnsz_x, scrnsz_y); - /* All done, fire up the actual emulated machine. */ - if (! pc_init_modules()) { - /* Dang, no ROMs found at all! */ - MessageBox(hwnd, - plat_get_string(IDS_2056), - plat_get_string(IDS_2050), - MB_OK | MB_ICONERROR); - return(6); - } - /* Fire up the machine. */ pc_reset_hard();