mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2025-01-26 01:51:15 +01:00
updated SDL port
This commit is contained in:
parent
41ffdefb1d
commit
fbf4c2be5a
@ -8,6 +8,7 @@
|
|||||||
#include "gpback.h"
|
#include "gpback.h"
|
||||||
|
|
||||||
/*** IPL Font (ripped from original BOOTROM) ***/
|
/*** IPL Font (ripped from original BOOTROM) ***/
|
||||||
|
#if 0
|
||||||
static unsigned char iplfont[]=
|
static unsigned char iplfont[]=
|
||||||
{
|
{
|
||||||
0x59,0x61,0x79,0x30,0x00,0x01,0x01,0x10,0x00,0x00,0x03,0x08,0x00,0x00,0x13,0x94,
|
0x59,0x61,0x79,0x30,0x00,0x01,0x01,0x10,0x00,0x00,0x03,0x08,0x00,0x00,0x13,0x94,
|
||||||
@ -611,6 +612,7 @@ static unsigned char iplfont[]=
|
|||||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||||
0xff,0xff,0xff,0xff,0xa2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
0xff,0xff,0xff,0xff,0xa2,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/*** Backdrop ***/
|
/*** Backdrop ***/
|
||||||
char backdrop[(640 * 480 * 2) + 32];
|
char backdrop[(640 * 480 * 2) + 32];
|
||||||
@ -725,19 +727,43 @@ void untile(unsigned char *dst, unsigned char *src, int xres, int yres)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int font_offset[256], font_size[256], fheight;
|
int font_offset[256], font_size[256], fheight;
|
||||||
//extern void __SYS_ReadROM(void *buf,u32 len,u32 offset);
|
extern void __SYS_ReadROM(void *buf,u32 len,u32 offset);
|
||||||
|
|
||||||
|
/* lowlevel Qoob Modchip disable (code from emukiddid) */
|
||||||
|
#ifndef HW_RVL
|
||||||
|
void ipl_set_config(unsigned char c)
|
||||||
|
{
|
||||||
|
volatile unsigned long* exi = (volatile unsigned long*)0xCC006800;
|
||||||
|
unsigned long val,addr;
|
||||||
|
addr=0xc0000000;
|
||||||
|
val = c << 24;
|
||||||
|
exi[0] = ((((exi[0]) & 0x405) | 256) | 48); //select IPL
|
||||||
|
//write addr of IPL
|
||||||
|
exi[0 * 5 + 4] = addr;
|
||||||
|
exi[0 * 5 + 3] = ((4 - 1) << 4) | (1 << 2) | 1;
|
||||||
|
while (exi[0 * 5 + 3] & 1);
|
||||||
|
//write the ipl we want to send
|
||||||
|
exi[0 * 5 + 4] = val;
|
||||||
|
exi[0 * 5 + 3] = ((4 - 1) << 4) | (1 << 2) | 1;
|
||||||
|
while (exi[0 * 5 + 3] & 1);
|
||||||
|
exi[0] &= 0x405; //deselect IPL
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void init_font(void)
|
void init_font(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
//__SYS_ReadROM((unsigned char *)&fontFont,0x3000,0x1FCF00);
|
/* read font from IPL ROM */
|
||||||
memcpy(&fontFont, &iplfont, sizeof(iplfont));
|
//memcpy(&fontFont, &iplfont, sizeof(iplfont));
|
||||||
yay0_decode((unsigned char *)&fontFont, (unsigned char *)&fontWork);
|
memset(fontFont,0,0x3000);
|
||||||
FONT_HEADER *fnt;
|
#ifndef HW_RVL
|
||||||
|
ipl_set_config(6);
|
||||||
fnt = ( FONT_HEADER * )&fontWork;
|
#endif
|
||||||
|
__SYS_ReadROM((unsigned char *)&fontFont,0x3000,0x1FCF00);
|
||||||
|
|
||||||
|
yay0_decode((unsigned char *)&fontFont, (unsigned char *)&fontWork);
|
||||||
|
FONT_HEADER *fnt = ( FONT_HEADER * )&fontWork;
|
||||||
untile((unsigned char*)&fontFont, (unsigned char*)&fontWork[fnt->offset_tile], fnt->texture_width, fnt->texture_height);
|
untile((unsigned char*)&fontFont, (unsigned char*)&fontWork[fnt->offset_tile], fnt->texture_width, fnt->texture_height);
|
||||||
|
|
||||||
for (i=0; i<256; ++i)
|
for (i=0; i<256; ++i)
|
||||||
|
@ -259,14 +259,14 @@ int system_frame (int do_skip)
|
|||||||
/* update inputs */
|
/* update inputs */
|
||||||
update_input();
|
update_input();
|
||||||
|
|
||||||
/* set VBLANK flag (Dracula) */
|
/* set VBLANK flag */
|
||||||
status |= 0x08;
|
status |= 0x08;
|
||||||
|
|
||||||
/* Z80 interrupt is 16ms period (one frame) and 64us length (one scanline) */
|
/* Z80 interrupt is 16ms period (one frame) and 64us length (one scanline) */
|
||||||
zirq = 1;
|
zirq = 1;
|
||||||
z80_set_irq_line(0, ASSERT_LINE);
|
z80_set_irq_line(0, ASSERT_LINE);
|
||||||
|
|
||||||
/* delay between HINT, VBLANK and VINT (OutRunners, VR Troopers) */
|
/* delay between HINT, VBLANK and VINT (Dracula, OutRunners, VR Troopers) */
|
||||||
m68k_run(line_m68k + 84);
|
m68k_run(line_m68k + 84);
|
||||||
if (zreset && !zbusreq) z80_run(line_z80 + 39);
|
if (zreset && !zbusreq) z80_run(line_z80 + 39);
|
||||||
else count_z80 = line_z80 + 39;
|
else count_z80 = line_z80 + 39;
|
||||||
|
@ -75,6 +75,7 @@ int main (int argc, char *argv[])
|
|||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* load BIOS */
|
/* load BIOS */
|
||||||
memset(bios_rom, 0, sizeof(bios_rom));
|
memset(bios_rom, 0, sizeof(bios_rom));
|
||||||
FILE *f = fopen("./BIOS.bin", "rb");
|
FILE *f = fopen("./BIOS.bin", "rb");
|
||||||
@ -274,6 +275,7 @@ void dos_update_input(void)
|
|||||||
if(key[KEY_X]) input.pad[joynum] |= INPUT_Y;
|
if(key[KEY_X]) input.pad[joynum] |= INPUT_Y;
|
||||||
if(key[KEY_C]) input.pad[joynum] |= INPUT_Z;
|
if(key[KEY_C]) input.pad[joynum] |= INPUT_Z;
|
||||||
if(key[KEY_V]) input.pad[joynum] |= INPUT_MODE;
|
if(key[KEY_V]) input.pad[joynum] |= INPUT_MODE;
|
||||||
|
|
||||||
if(key[KEY_F]) input.pad[joynum] |= INPUT_START;
|
if(key[KEY_F]) input.pad[joynum] |= INPUT_START;
|
||||||
|
|
||||||
extern uint8 pico_current;
|
extern uint8 pico_current;
|
||||||
@ -495,6 +497,7 @@ void dos_update_video(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
stretch_blit(gen_bmp, screen, 0, 0, width, height, (SCREEN_W-352)/2, (SCREEN_H-240)/2, 352,240 << (interlaced ? 1:0));
|
stretch_blit(gen_bmp, screen, 0, 0, width, height, (SCREEN_W-352)/2, (SCREEN_H-240)/2, 352,240 << (interlaced ? 1:0));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ void set_config_defaults(void)
|
|||||||
config.fm_preamp = 1.0;
|
config.fm_preamp = 1.0;
|
||||||
config.boost = 1;
|
config.boost = 1;
|
||||||
config.filter = 1;
|
config.filter = 1;
|
||||||
config.hq_fm = 1;
|
config.hq_fm = 2;
|
||||||
config.fm_core = 0;
|
config.fm_core = 0;
|
||||||
|
|
||||||
/* system options */
|
/* system options */
|
||||||
@ -22,7 +22,8 @@ void set_config_defaults(void)
|
|||||||
/* display options */
|
/* display options */
|
||||||
config.aspect = 1;
|
config.aspect = 1;
|
||||||
config.overscan = 1;
|
config.overscan = 1;
|
||||||
config.render = 0;
|
config.render = 1;
|
||||||
|
config.ntsc = 0;
|
||||||
|
|
||||||
/* controllers options */
|
/* controllers options */
|
||||||
config.gun_cursor = 1;
|
config.gun_cursor = 1;
|
||||||
|
@ -21,6 +21,7 @@ typedef struct
|
|||||||
uint8 aspect;
|
uint8 aspect;
|
||||||
uint8 overscan;
|
uint8 overscan;
|
||||||
uint8 render;
|
uint8 render;
|
||||||
|
uint8 ntsc;
|
||||||
uint8 gun_cursor;
|
uint8 gun_cursor;
|
||||||
uint8 invert_mouse;
|
uint8 invert_mouse;
|
||||||
} t_config;
|
} t_config;
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
#include "shared.h"
|
#include "shared.h"
|
||||||
|
#include "sms_ntsc.h"
|
||||||
|
#include "md_ntsc.h"
|
||||||
|
|
||||||
#define SOUND_FREQUENCY 48000
|
#define SOUND_FREQUENCY 48000
|
||||||
|
|
||||||
@ -24,29 +26,10 @@ uint8 log_error = 0;
|
|||||||
uint8 debug_on = 0;
|
uint8 debug_on = 0;
|
||||||
uint8 turbo_mode = 0;
|
uint8 turbo_mode = 0;
|
||||||
uint8 use_sound = 1;
|
uint8 use_sound = 1;
|
||||||
|
uint8 fullscreen = 0;
|
||||||
|
|
||||||
int audio_len;
|
int audio_len;
|
||||||
|
|
||||||
Uint32 fps_callback(Uint32 interval)
|
|
||||||
{
|
|
||||||
if(paused) return 1000/vdp_rate;
|
|
||||||
timer_count++;
|
|
||||||
frameticker ++;
|
|
||||||
if(timer_count % vdp_rate == 0)
|
|
||||||
{
|
|
||||||
int fps = frame_count + 1;
|
|
||||||
char caption[100];
|
|
||||||
char region[10];
|
|
||||||
if (region_code == REGION_USA) sprintf(region,"USA");
|
|
||||||
else if (region_code == REGION_EUROPE) sprintf(region,"EUR");
|
|
||||||
else sprintf(region,"JAP");
|
|
||||||
sprintf(caption, "Genesis Plus/SDL - %s (%s) - %d fps - %d bytes", rominfo.international, region, fps, audio_len);
|
|
||||||
SDL_WM_SetCaption(caption, NULL);
|
|
||||||
frame_count = 0;
|
|
||||||
|
|
||||||
}
|
|
||||||
return 1000/vdp_rate;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void sdl_sound_callback(void *userdata, Uint8 *stream, int len)
|
static void sdl_sound_callback(void *userdata, Uint8 *stream, int len)
|
||||||
{
|
{
|
||||||
@ -95,13 +78,64 @@ static int sdl_sound_init()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static SDL_Rect rect;
|
||||||
|
static SDL_Surface* screen;
|
||||||
|
static SDL_Surface* surface;
|
||||||
|
static unsigned char* output_pixels; /* 16-bit RGB */
|
||||||
|
static long output_pitch;
|
||||||
|
|
||||||
|
Uint32 fps_callback(Uint32 interval)
|
||||||
|
{
|
||||||
|
if(paused) return 1000/vdp_rate;
|
||||||
|
timer_count++;
|
||||||
|
frameticker ++;
|
||||||
|
if(timer_count % vdp_rate == 0)
|
||||||
|
{
|
||||||
|
int fps = frame_count + 1;
|
||||||
|
char caption[100];
|
||||||
|
char region[10];
|
||||||
|
if (region_code == REGION_USA) sprintf(region,"USA");
|
||||||
|
else if (region_code == REGION_EUROPE) sprintf(region,"EUR");
|
||||||
|
else sprintf(region,"JAP");
|
||||||
|
sprintf(caption, "Genesis Plus/SDL - %s (%s) - %d fps", rominfo.international, region, fps);
|
||||||
|
SDL_WM_SetCaption(caption, NULL);
|
||||||
|
frame_count = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
return 1000/vdp_rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void lock_pixels( void )
|
||||||
|
{
|
||||||
|
if ( SDL_LockSurface( surface ) < 0 )
|
||||||
|
MessageBox(NULL, "Couldn't lock surface", "Error", 0);
|
||||||
|
SDL_FillRect( surface, 0, 0 );
|
||||||
|
output_pitch = surface->pitch;
|
||||||
|
output_pixels = (unsigned char*) surface->pixels;
|
||||||
|
}
|
||||||
|
|
||||||
|
void display_output( void )
|
||||||
|
{
|
||||||
|
SDL_Rect dest;
|
||||||
|
dest.w=rect.w;
|
||||||
|
dest.h=rect.h;
|
||||||
|
dest.x=(640-rect.w)/2;
|
||||||
|
dest.y=(480-rect.h)/2;
|
||||||
|
//SDL_UnlockSurface( surface );
|
||||||
|
if ( SDL_BlitSurface( surface, &rect, screen, &dest ) < 0 || SDL_Flip( screen ) < 0 )
|
||||||
|
MessageBox(NULL, "SDL blit failed", "Error", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
md_ntsc_t md_ntsc;
|
||||||
|
sms_ntsc_t sms_ntsc;
|
||||||
|
|
||||||
int main (int argc, char **argv)
|
int main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
int running = 1;
|
int running = 1;
|
||||||
int sym;
|
int sym;
|
||||||
|
md_ntsc_setup_t md_setup;
|
||||||
|
sms_ntsc_setup_t sms_setup;
|
||||||
|
|
||||||
SDL_Rect viewport, display;
|
|
||||||
SDL_Surface *bmp, *screen;
|
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
|
|
||||||
error_init();
|
error_init();
|
||||||
@ -126,6 +160,43 @@ int main (int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* initialize SDL */
|
||||||
|
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
|
||||||
|
{
|
||||||
|
char caption[256];
|
||||||
|
sprintf(caption, "SDL initialization failed");
|
||||||
|
MessageBox(NULL, caption, "Error", 0);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
SDL_WM_SetCaption("Genesis Plus/SDL", NULL);
|
||||||
|
SDL_ShowCursor(0);
|
||||||
|
|
||||||
|
screen = SDL_SetVideoMode(640, 480, 16, fullscreen ? (SDL_SWSURFACE|SDL_FULLSCREEN): (SDL_SWSURFACE));
|
||||||
|
surface = SDL_CreateRGBSurface(SDL_SWSURFACE, 720, 576, 16, 0, 0, 0, 0);
|
||||||
|
if (!screen || !surface)
|
||||||
|
{
|
||||||
|
MessageBox(NULL, "Video initialization failed", "Error", 0);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* initialize Genesis display */
|
||||||
|
memset(&bitmap, 0, sizeof(t_bitmap));
|
||||||
|
bitmap.width = 720;
|
||||||
|
bitmap.height = 576;
|
||||||
|
bitmap.depth = 16;
|
||||||
|
bitmap.granularity = 2;
|
||||||
|
bitmap.pitch = (bitmap.width * bitmap.granularity);
|
||||||
|
bitmap.data = surface->pixels;
|
||||||
|
bitmap.viewport.w = 256;
|
||||||
|
bitmap.viewport.h = 224;
|
||||||
|
bitmap.viewport.x = 0;
|
||||||
|
bitmap.viewport.y = 0;
|
||||||
|
|
||||||
|
/* set default config */
|
||||||
|
set_config_defaults();
|
||||||
|
input.system[0] = SYSTEM_GAMEPAD;
|
||||||
|
input.system[1] = SYSTEM_GAMEPAD;
|
||||||
|
|
||||||
/* load BIOS */
|
/* load BIOS */
|
||||||
memset(bios_rom, 0, sizeof(bios_rom));
|
memset(bios_rom, 0, sizeof(bios_rom));
|
||||||
FILE *f = fopen("./BIOS.bin", "rb");
|
FILE *f = fopen("./BIOS.bin", "rb");
|
||||||
@ -142,59 +213,6 @@ int main (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
config.bios_enabled |= 2;
|
config.bios_enabled |= 2;
|
||||||
}
|
}
|
||||||
else config.bios_enabled = 0;
|
|
||||||
|
|
||||||
/* initialize SDL */
|
|
||||||
if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0)
|
|
||||||
{
|
|
||||||
char caption[256];
|
|
||||||
sprintf(caption, "SDL initialization failed");
|
|
||||||
MessageBox(NULL, caption, "Error", 0);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
SDL_WM_SetCaption("Genesis Plus/SDL", NULL);
|
|
||||||
SDL_ShowCursor(0);
|
|
||||||
|
|
||||||
/* initialize SDL video */
|
|
||||||
viewport.x = 0;
|
|
||||||
viewport.y = 0;
|
|
||||||
viewport.w = 640;
|
|
||||||
viewport.h = 480;
|
|
||||||
|
|
||||||
display.x = 0;
|
|
||||||
display.y = 0;
|
|
||||||
display.w = 256;
|
|
||||||
display.h = 224;
|
|
||||||
|
|
||||||
bmp = SDL_CreateRGBSurface(SDL_HWSURFACE, 360, 576, 16, 0xF800, 0x07E0, 0x001F, 0x0000);
|
|
||||||
screen = SDL_SetVideoMode(viewport.w, viewport.h, 16, SDL_HWSURFACE);
|
|
||||||
if (!bmp || !screen)
|
|
||||||
{
|
|
||||||
char caption[256];
|
|
||||||
sprintf(caption, "Video initialization failed");
|
|
||||||
MessageBox(NULL, caption, "Error", 0);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* initialize Genesis display */
|
|
||||||
memset(&bitmap, 0, sizeof(t_bitmap));
|
|
||||||
bitmap.width = 360;
|
|
||||||
bitmap.height = 576;
|
|
||||||
bitmap.depth = 16;
|
|
||||||
bitmap.granularity = 2;
|
|
||||||
bitmap.pitch = (bitmap.width * bitmap.granularity);
|
|
||||||
bitmap.data = (unsigned char *)bmp->pixels;
|
|
||||||
bitmap.viewport.w = 256;
|
|
||||||
bitmap.viewport.h = 224;
|
|
||||||
bitmap.viewport.x = 0;
|
|
||||||
bitmap.viewport.y = 0;
|
|
||||||
bitmap.remap = 1;
|
|
||||||
|
|
||||||
/* set default config */
|
|
||||||
set_config_defaults();
|
|
||||||
input.system[0] = SYSTEM_GAMEPAD;
|
|
||||||
input.system[1] = SYSTEM_MOUSE;
|
|
||||||
|
|
||||||
/* initialize emulation */
|
/* initialize emulation */
|
||||||
system_init();
|
system_init();
|
||||||
@ -207,7 +225,7 @@ int main (int argc, char **argv)
|
|||||||
f = fopen("./game.srm", "rb");
|
f = fopen("./game.srm", "rb");
|
||||||
if (f!=NULL)
|
if (f!=NULL)
|
||||||
{
|
{
|
||||||
fread(&sram.sram,0x10000,1, f);
|
fread(sram.sram,0x10000,1, f);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,6 +258,20 @@ int main (int argc, char **argv)
|
|||||||
sym = event.key.keysym.sym;
|
sym = event.key.keysym.sym;
|
||||||
|
|
||||||
if(sym == SDLK_TAB) system_reset();
|
if(sym == SDLK_TAB) system_reset();
|
||||||
|
else if (sym == SDLK_RETURN)
|
||||||
|
{
|
||||||
|
fullscreen ^=1;
|
||||||
|
screen = SDL_SetVideoMode(640, 480, 16, fullscreen ? (SDL_SWSURFACE|SDL_FULLSCREEN): (SDL_SWSURFACE));
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(sym == SDLK_F3) config.render ^=1;
|
||||||
|
else if(sym == SDLK_F4)
|
||||||
|
{
|
||||||
|
SDL_FillRect( screen, 0, 0 );
|
||||||
|
config.ntsc ++;
|
||||||
|
if (config.ntsc > 3) config.ntsc = 0;
|
||||||
|
bitmap.viewport.changed = 1;
|
||||||
|
}
|
||||||
else if(sym == SDLK_F5) log_error ^=1;
|
else if(sym == SDLK_F5) log_error ^=1;
|
||||||
else if(sym == SDLK_F6)
|
else if(sym == SDLK_F6)
|
||||||
{
|
{
|
||||||
@ -321,8 +353,9 @@ int main (int argc, char **argv)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Delay */
|
/* Delay */
|
||||||
while (!frameticker && !turbo_mode) SDL_Delay(1);
|
while (!frameticker && !turbo_mode) SDL_Delay(0);
|
||||||
|
|
||||||
|
//SDL_FillRect( surface, 0, 0 );
|
||||||
system_frame (0);
|
system_frame (0);
|
||||||
frame_count++;
|
frame_count++;
|
||||||
}
|
}
|
||||||
@ -332,16 +365,36 @@ int main (int argc, char **argv)
|
|||||||
if(bitmap.viewport.changed)
|
if(bitmap.viewport.changed)
|
||||||
{
|
{
|
||||||
bitmap.viewport.changed = 0;
|
bitmap.viewport.changed = 0;
|
||||||
display.w = (bitmap.viewport.w + 2*bitmap.viewport.x);
|
rect.w = bitmap.viewport.w+2*bitmap.viewport.x;
|
||||||
display.h = (bitmap.viewport.h + 2 * bitmap.viewport.y) << ((config.render && interlaced) ? 1:0);
|
rect.h = bitmap.viewport.h+2*bitmap.viewport.y;
|
||||||
viewport.w = bitmap.viewport.w + 2*bitmap.viewport.x;
|
if (config.render && (interlaced || config.ntsc)) rect.h *= 2;
|
||||||
viewport.h = bitmap.viewport.h + 2*bitmap.viewport.y;
|
if (config.ntsc) rect.w = (reg[12]&1) ? MD_NTSC_OUT_WIDTH(rect.w) : SMS_NTSC_OUT_WIDTH(rect.w);
|
||||||
viewport.x = (640 - viewport.w)/2;
|
|
||||||
viewport.y = (480 - viewport.h)/2;
|
/* init NTSC filter */
|
||||||
|
if (config.ntsc == 1)
|
||||||
|
{
|
||||||
|
sms_setup = sms_ntsc_composite;
|
||||||
|
md_setup = md_ntsc_composite;
|
||||||
|
sms_ntsc_init( &sms_ntsc, &sms_setup );
|
||||||
|
md_ntsc_init( &md_ntsc, &md_setup );
|
||||||
|
}
|
||||||
|
else if (config.ntsc == 2)
|
||||||
|
{
|
||||||
|
sms_setup = sms_ntsc_svideo;
|
||||||
|
md_setup = md_ntsc_svideo;
|
||||||
|
sms_ntsc_init( &sms_ntsc, &sms_setup );
|
||||||
|
md_ntsc_init( &md_ntsc, &md_setup );
|
||||||
|
}
|
||||||
|
else if (config.ntsc == 3)
|
||||||
|
{
|
||||||
|
sms_setup = sms_ntsc_rgb;
|
||||||
|
md_setup = md_ntsc_rgb;
|
||||||
|
sms_ntsc_init( &sms_ntsc, &sms_setup );
|
||||||
|
md_ntsc_init( &md_ntsc, &md_setup );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_BlitSurface(bmp, &display, screen, &viewport);
|
display_output();
|
||||||
SDL_UpdateRect(screen, viewport.x, viewport.y, viewport.w, viewport.h);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,7 +408,7 @@ int main (int argc, char **argv)
|
|||||||
|
|
||||||
SDL_PauseAudio(1);
|
SDL_PauseAudio(1);
|
||||||
SDL_CloseAudio();
|
SDL_CloseAudio();
|
||||||
SDL_FreeSurface(bmp);
|
SDL_FreeSurface(surface);
|
||||||
SDL_FreeSurface(screen);
|
SDL_FreeSurface(screen);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
system_shutdown();
|
system_shutdown();
|
||||||
@ -445,7 +498,6 @@ int update_input(void)
|
|||||||
if(state & SDL_BUTTON_LMASK) input.pad[joynum] |= INPUT_A;
|
if(state & SDL_BUTTON_LMASK) input.pad[joynum] |= INPUT_A;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* options */
|
/* options */
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
@ -604,7 +604,7 @@ unsigned int vdp_ctrl_r(void)
|
|||||||
if (!(reg[1] & 0x40)) temp |= 0x8;
|
if (!(reg[1] & 0x40)) temp |= 0x8;
|
||||||
|
|
||||||
/* HBLANK flag (Sonic 3 and Sonic 2 "VS Modes", Lemmings 2) */
|
/* HBLANK flag (Sonic 3 and Sonic 2 "VS Modes", Lemmings 2) */
|
||||||
if ((count_m68k <= (line_m68k + 84)) || (count_m68k > (line_m68k + 488))) temp |= 0x4;
|
if ((count_m68k <= (line_m68k + 84)) || (count_m68k > (line_m68k + m68cycles_per_line))) temp |= 0x4;
|
||||||
|
|
||||||
/* clear pending flag */
|
/* clear pending flag */
|
||||||
pending = 0;
|
pending = 0;
|
||||||
@ -766,7 +766,7 @@ void vdp_reg_w(unsigned int r, unsigned int d)
|
|||||||
color_update(0x00, *(uint16 *)&cram[(border << 1)]);
|
color_update(0x00, *(uint16 *)&cram[(border << 1)]);
|
||||||
|
|
||||||
/* background color modified during HBLANK */
|
/* background color modified during HBLANK */
|
||||||
if (count_m68k <= (line_m68k + 84))
|
if ((v_counter < bitmap.viewport.h) && (count_m68k <= (line_m68k + 84)))
|
||||||
{
|
{
|
||||||
/* remap current line (see Road Rash I,II,III) */
|
/* remap current line (see Road Rash I,II,III) */
|
||||||
reg[7] = d;
|
reg[7] = d;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user