mirror of
https://github.com/InvisibleUp/uvmac.git
synced 2024-11-29 22:49:27 +00:00
Fix start-up crash due to invalid SDL usage
This is now, minus configuration, fully functional again. Nice.
This commit is contained in:
parent
b889a8117a
commit
b4854c1546
@ -591,10 +591,11 @@ LOCALPROC VIA1_Clear(void)
|
|||||||
VIA1_T1IntReady = false;
|
VIA1_T1IntReady = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLOBALPROC VIA1_Zap(void)
|
bool VIA1_Zap(void)
|
||||||
{
|
{
|
||||||
VIA1_Clear();
|
VIA1_Clear();
|
||||||
VIA1_InterruptRequest = 0;
|
VIA1_InterruptRequest = 0;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
GLOBALPROC VIA1_Reset(void)
|
GLOBALPROC VIA1_Reset(void)
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#define VIAEMDEV_H
|
#define VIAEMDEV_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
void VIA1_Zap(void);
|
bool VIA1_Zap(void);
|
||||||
void VIA1_Reset(void);
|
void VIA1_Reset(void);
|
||||||
|
|
||||||
uint32_t VIA1_Access(uint32_t Data, bool WriteMem, uint32_t addr);
|
uint32_t VIA1_Access(uint32_t Data, bool WriteMem, uint32_t addr);
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <assert.h>
|
||||||
#include "SYSDEPNS.h"
|
#include "SYSDEPNS.h"
|
||||||
|
|
||||||
#include "UI/MYOSGLUE.h"
|
#include "UI/MYOSGLUE.h"
|
||||||
@ -155,16 +156,6 @@ const DevMethods_t DEVICES[] = {
|
|||||||
.timebegin = EmVIA2 ? VIA2_ExtraTimeBegin : NULL,
|
.timebegin = EmVIA2 ? VIA2_ExtraTimeBegin : NULL,
|
||||||
.timeend = EmVIA2 ? VIA2_ExtraTimeEnd : NULL,
|
.timeend = EmVIA2 ? VIA2_ExtraTimeEnd : NULL,
|
||||||
},
|
},
|
||||||
// Screen
|
|
||||||
{
|
|
||||||
.init = NULL,
|
|
||||||
.reset = NULL,
|
|
||||||
.starttick = Sixtieth_PulseNtfy, // VBlank interrupt
|
|
||||||
.endtick = Screen_EndTickNotify,
|
|
||||||
.subtick = NULL,
|
|
||||||
.timebegin = NULL,
|
|
||||||
.timeend = NULL,
|
|
||||||
},
|
|
||||||
// Sony disk drive
|
// Sony disk drive
|
||||||
{
|
{
|
||||||
.init = NULL,
|
.init = NULL,
|
||||||
@ -263,7 +254,17 @@ const DevMethods_t DEVICES[] = {
|
|||||||
.subtick = (SoundEnabled && (CurEmMd != kEmMd_PB100)) ? MacSound_SubTick : NULL,
|
.subtick = (SoundEnabled && (CurEmMd != kEmMd_PB100)) ? MacSound_SubTick : NULL,
|
||||||
.timebegin = NULL,
|
.timebegin = NULL,
|
||||||
.timeend = NULL
|
.timeend = NULL
|
||||||
}
|
},
|
||||||
|
// Screen
|
||||||
|
{
|
||||||
|
.init = NULL,
|
||||||
|
.reset = NULL,
|
||||||
|
.starttick = Sixtieth_PulseNtfy, // VBlank interrupt
|
||||||
|
.endtick = Screen_EndTickNotify,
|
||||||
|
.subtick = NULL,
|
||||||
|
.timebegin = NULL,
|
||||||
|
.timeend = NULL,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
LOCALPROC EmulatedHardwareZap(void)
|
LOCALPROC EmulatedHardwareZap(void)
|
||||||
@ -406,8 +407,7 @@ LOCALFUNC bool InitEmulation(void)
|
|||||||
int i;
|
int i;
|
||||||
for ( i = 0; i < ARRAY_SIZE(DEVICES); i++ ) {
|
for ( i = 0; i < ARRAY_SIZE(DEVICES); i++ ) {
|
||||||
if (DEVICES[i].init != NULL) {
|
if (DEVICES[i].init != NULL) {
|
||||||
bool retval = DEVICES[i].init();
|
assert(DEVICES[i].init());
|
||||||
if (retval == false) { return false; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,13 +336,6 @@ LOCALFUNC bool CreateMainWindow(void)
|
|||||||
Uint32 flags = 0 /* SDL_WINDOW_HIDDEN */;
|
Uint32 flags = 0 /* SDL_WINDOW_HIDDEN */;
|
||||||
bool v = false;
|
bool v = false;
|
||||||
|
|
||||||
#if 1 && 1
|
|
||||||
if (UseMagnify) {
|
|
||||||
NewWindowHeight *= WindowScale;
|
|
||||||
NewWindowWidth *= WindowScale;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if (UseFullScreen)
|
if (UseFullScreen)
|
||||||
#endif
|
#endif
|
||||||
@ -396,8 +389,7 @@ LOCALFUNC bool CreateMainWindow(void)
|
|||||||
NewWindowWidth, NewWindowHeight,
|
NewWindowWidth, NewWindowHeight,
|
||||||
flags)))
|
flags)))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SDL_CreateWindow fails: %s\n",
|
fprintf(stderr, "SDL_CreateWindow fails: %s\n", SDL_GetError());
|
||||||
SDL_GetError());
|
|
||||||
} else
|
} else
|
||||||
if (NULL == (renderer = SDL_CreateRenderer(
|
if (NULL == (renderer = SDL_CreateRenderer(
|
||||||
main_wind, -1,
|
main_wind, -1,
|
||||||
@ -410,34 +402,24 @@ LOCALFUNC bool CreateMainWindow(void)
|
|||||||
/* would rather not require vsync */
|
/* would rather not require vsync */
|
||||||
)))
|
)))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SDL_CreateRenderer fails: %s\n",
|
fprintf(stderr, "SDL_CreateRenderer fails: %s\n", SDL_GetError());
|
||||||
SDL_GetError());
|
|
||||||
} else
|
} else
|
||||||
if (NULL == (texture = SDL_CreateTexture(
|
if (NULL == (texture = SDL_CreateTexture(
|
||||||
renderer,
|
renderer,
|
||||||
SDL_PIXELFORMAT_ARGB8888,
|
SDL_PIXELFORMAT_RGBX8888,
|
||||||
SDL_TEXTUREACCESS_STREAMING,
|
SDL_TEXTUREACCESS_STREAMING,
|
||||||
#if UseSDLscaling
|
|
||||||
vMacScreenWidth, vMacScreenHeight
|
vMacScreenWidth, vMacScreenHeight
|
||||||
#else
|
|
||||||
NewWindowWidth, NewWindowHeight
|
|
||||||
#endif
|
|
||||||
)))
|
)))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SDL_CreateTexture fails: %s\n",
|
fprintf(stderr, "SDL_CreateTexture fails: %s\n", SDL_GetError());
|
||||||
SDL_GetError());
|
|
||||||
} else
|
} else
|
||||||
if (NULL == (format = SDL_AllocFormat(SDL_PIXELFORMAT_ARGB8888)))
|
if (NULL == (format = SDL_AllocFormat(SDL_PIXELFORMAT_ARGB8888)))
|
||||||
{
|
{
|
||||||
fprintf(stderr, "SDL_AllocFormat fails: %s\n",
|
fprintf(stderr, "SDL_AllocFormat fails: %s\n", SDL_GetError());
|
||||||
SDL_GetError());
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
/* SDL_ShowWindow(main_wind); */
|
|
||||||
|
|
||||||
SDL_RenderClear(renderer);
|
SDL_RenderClear(renderer);
|
||||||
|
|
||||||
#if 0
|
|
||||||
SDL_DisplayMode info;
|
SDL_DisplayMode info;
|
||||||
|
|
||||||
if (0 != SDL_GetCurrentDisplayMode(0, &info)) {
|
if (0 != SDL_GetCurrentDisplayMode(0, &info)) {
|
||||||
@ -446,7 +428,6 @@ LOCALFUNC bool CreateMainWindow(void)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
if (UseFullScreen)
|
if (UseFullScreen)
|
||||||
|
@ -22,7 +22,7 @@ bool UseMagnify = (WantInitMagnify != 0);
|
|||||||
|
|
||||||
bool gBackgroundFlag = false;
|
bool gBackgroundFlag = false;
|
||||||
bool gTrueBackgroundFlag = false;
|
bool gTrueBackgroundFlag = false;
|
||||||
bool CurSpeedStopped = true;
|
bool CurSpeedStopped = false;
|
||||||
SDL_Window *main_wind = NULL;
|
SDL_Window *main_wind = NULL;
|
||||||
SDL_Renderer *renderer = NULL;
|
SDL_Renderer *renderer = NULL;
|
||||||
SDL_Texture *texture = NULL;
|
SDL_Texture *texture = NULL;
|
||||||
@ -66,18 +66,38 @@ GLOBALOSGLUPROC Screen_OutputFrame(uint8_t * src_ptr)
|
|||||||
{
|
{
|
||||||
if (EmVideoDisable) { return; }
|
if (EmVideoDisable) { return; }
|
||||||
|
|
||||||
uint32_t src_format = GetPixFormatFromDepth(vMacScreenDepth);
|
uint32_t src_format = GetPixFormatFromDepth(vMacScreenDepth+1);
|
||||||
|
void *pixels;
|
||||||
|
int pitch;
|
||||||
|
|
||||||
|
// Setup source surface
|
||||||
SDL_Surface *src = SDL_CreateRGBSurfaceWithFormatFrom(
|
SDL_Surface *src = SDL_CreateRGBSurfaceWithFormatFrom(
|
||||||
src_ptr,
|
src_ptr,
|
||||||
vMacScreenWidth,
|
vMacScreenWidth,
|
||||||
vMacScreenHeight,
|
vMacScreenHeight,
|
||||||
vMacScreenDepth,
|
vMacScreenDepth+1,
|
||||||
vMacScreenByteWidth,
|
vMacScreenByteWidth,
|
||||||
src_format
|
src_format
|
||||||
);
|
);
|
||||||
|
|
||||||
SDL_LockTexture(texture, NULL, NULL, NULL);
|
// Setup dst surface
|
||||||
|
SDL_LockTexture(texture, NULL, &pixels, &pitch);
|
||||||
|
SDL_Surface *dst = SDL_CreateRGBSurfaceWithFormatFrom(
|
||||||
|
pixels,
|
||||||
|
vMacScreenWidth,
|
||||||
|
vMacScreenHeight,
|
||||||
|
32, vMacScreenWidth * 4,
|
||||||
|
SDL_PIXELFORMAT_RGBX8888
|
||||||
|
);
|
||||||
|
|
||||||
|
// Blit src to dst
|
||||||
|
SDL_BlitSurface(src, NULL, dst, NULL);
|
||||||
|
|
||||||
|
// Free surfaces
|
||||||
|
SDL_FreeSurface(src);
|
||||||
|
SDL_FreeSurface(dst);
|
||||||
|
|
||||||
|
// Render the texture
|
||||||
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
SDL_RenderCopy(renderer, texture, NULL, NULL);
|
||||||
SDL_UnlockTexture(texture);
|
SDL_UnlockTexture(texture);
|
||||||
SDL_RenderPresent(renderer);
|
SDL_RenderPresent(renderer);
|
||||||
|
Loading…
Reference in New Issue
Block a user