Updated Win32 porting code

This commit is contained in:
ekeeke31 2010-12-04 17:16:55 +00:00
parent 24e84a7951
commit 14f79ab792
4 changed files with 35 additions and 35 deletions

View File

@ -382,13 +382,15 @@ void dos_update_input(void)
free(temp); free(temp);
} }
/* reinitialize HVC tables */ /* reinitialize VC max value */
vctab = vdp_pal ? ((reg[1] & 8) ? vc_pal_240 : vc_pal_224) : vc_ntsc_224; vc_max = 0xEA + 24*vdp_pal;
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32; if (reg[1] & 8)
{
vc_max += (28 - 20*vdp_pal);
}
/* reinitialize overscan area */ /* reinitialize overscan area */
bitmap.viewport.x = config.overscan ? 14 : 0; bitmap.viewport.y = (config.overscan & 1) ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
bitmap.viewport.y = config.overscan ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
} }
if(check_key(KEY_F10)) set_softreset(); if(check_key(KEY_F10)) set_softreset();

View File

@ -6,7 +6,7 @@
# #
# Defines : # Defines :
# -DLSB_FIRST : for little endian systems. # -DLSB_FIRST : for little endian systems.
# -DLOGERROR : enable message log # -DLOGERROR : enable message logging
# -DLOGVDP : enable VDP debug messages # -DLOGVDP : enable VDP debug messages
# -DLOGSOUND : enable AUDIO debug messages # -DLOGSOUND : enable AUDIO debug messages
@ -43,7 +43,8 @@ OBJECTS += obj/sound.o \
obj/sn76489.o \ obj/sn76489.o \
obj/ym2612.o obj/ym2612.o
OBJECTS += obj/Fir_Resampler.o \ OBJECTS += obj/Fir_Resampler.o
OBJECTS += obj/blip.o
OBJECTS += obj/eq.o \ OBJECTS += obj/eq.o \
@ -52,7 +53,7 @@ OBJECTS += obj/sram.o \
obj/svp.o \ obj/svp.o \
obj/ssp16.o \ obj/ssp16.o \
obj/ggenie.o \ obj/ggenie.o \
obj/datel.o \ obj/areplay.o \
obj/cart_hw.o obj/cart_hw.o
OBJECTS += obj/main.o \ OBJECTS += obj/main.o \

View File

@ -19,8 +19,8 @@ void set_config_defaults(void)
config.lg = 1.0; config.lg = 1.0;
config.mg = 1.0; config.mg = 1.0;
config.hg = 1.0; config.hg = 1.0;
config.lp_range = 50; config.lp_range = 60;
config.rolloff = 0.999; config.rolloff = 0.995;
config.dac_bits = 14; config.dac_bits = 14;
/* system options */ /* system options */

View File

@ -10,7 +10,7 @@
#define SOUND_FREQUENCY 48000 #define SOUND_FREQUENCY 48000
#define SOUND_SAMPLES_SIZE 2048 #define SOUND_SAMPLES_SIZE 2048
#define VIDEO_WIDTH 320 #define VIDEO_WIDTH 320
#define VIDEO_HEIGHT 240 #define VIDEO_HEIGHT 240
int joynum = 0; int joynum = 0;
@ -137,7 +137,6 @@ static int sdl_video_init()
sdl_video.surf_screen = SDL_SetVideoMode(VIDEO_WIDTH, VIDEO_HEIGHT, 16, SDL_SWSURFACE | fullscreen); sdl_video.surf_screen = SDL_SetVideoMode(VIDEO_WIDTH, VIDEO_HEIGHT, 16, SDL_SWSURFACE | fullscreen);
sdl_video.surf_bitmap = SDL_CreateRGBSurface(SDL_SWSURFACE, 720, 576, 16, 0, 0, 0, 0); sdl_video.surf_bitmap = SDL_CreateRGBSurface(SDL_SWSURFACE, 720, 576, 16, 0, 0, 0, 0);
sdl_video.frames_rendered = 0; sdl_video.frames_rendered = 0;
SDL_WM_SetCaption("Genesis Plus/SDL", NULL);
SDL_ShowCursor(0); SDL_ShowCursor(0);
return 1; return 1;
@ -163,7 +162,7 @@ static void sdl_video_update()
sdl_video.srect.w = VIDEO_WIDTH; sdl_video.srect.w = VIDEO_WIDTH;
} }
if (sdl_video.srect.h > VIDEO_HEIGHT) if (sdl_video.srect.h > VIDEO_HEIGHT)
{ {
sdl_video.srect.y = (sdl_video.srect.h - VIDEO_HEIGHT) / 2; sdl_video.srect.y = (sdl_video.srect.h - VIDEO_HEIGHT) / 2;
sdl_video.srect.h = VIDEO_HEIGHT; sdl_video.srect.h = VIDEO_HEIGHT;
} }
@ -173,7 +172,7 @@ static void sdl_video_update()
sdl_video.drect.h = sdl_video.srect.h; sdl_video.drect.h = sdl_video.srect.h;
sdl_video.drect.x = (VIDEO_WIDTH - sdl_video.drect.w) / 2; sdl_video.drect.x = (VIDEO_WIDTH - sdl_video.drect.w) / 2;
sdl_video.drect.y = (VIDEO_HEIGHT - sdl_video.drect.h) / 2; sdl_video.drect.y = (VIDEO_HEIGHT - sdl_video.drect.h) / 2;
/* clear destination surface */ /* clear destination surface */
SDL_FillRect(sdl_video.surf_screen, 0, 0); SDL_FillRect(sdl_video.surf_screen, 0, 0);
@ -248,7 +247,7 @@ static Uint32 sdl_sync_timer_callback(Uint32 interval)
{ {
int fps = vdp_pal ? (sdl_video.frames_rendered / 3) : sdl_video.frames_rendered; int fps = vdp_pal ? (sdl_video.frames_rendered / 3) : sdl_video.frames_rendered;
sdl_sync.ticks = sdl_video.frames_rendered = 0; sdl_sync.ticks = sdl_video.frames_rendered = 0;
sprintf(caption, "Genesis Plus SDL - %d FPS", fps); sprintf(caption,"%d fps - %s ", fps, rominfo.international);
SDL_WM_SetCaption(caption, NULL); SDL_WM_SetCaption(caption, NULL);
} }
return interval; return interval;
@ -300,9 +299,6 @@ static int sdl_control_update(SDLKey keystate)
case SDLK_F4: case SDLK_F4:
{ {
/*config.ntsc ++;
if (config.ntsc > 3) config.ntsc = 0;
bitmap.viewport.changed = 1;*/
if (!turbo_mode) use_sound ^= 1; if (!turbo_mode) use_sound ^= 1;
break; break;
} }
@ -365,19 +361,21 @@ static int sdl_control_update(SDLKey keystate)
free(temp); free(temp);
} }
/* reinitialize HVC tables */ /* reinitialize VC max value */
vctab = vdp_pal ? ((reg[1] & 8) ? vc_pal_240 : vc_pal_224) : vc_ntsc_224; vc_max = 0xEA + 24*vdp_pal;
hctab = (reg[12] & 1) ? cycle2hc40 : cycle2hc32; if (reg[1] & 8)
{
vc_max += (28 - 20*vdp_pal);
}
/* reinitialize overscan area */ /* reinitialize display area */
bitmap.viewport.x = (config.overscan & 2) ? ((reg[12] & 1) ? 16 : 12) : 0; bitmap.viewport.changed = 3;
bitmap.viewport.y = (config.overscan & 1) ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
bitmap.viewport.changed = 1;
break; break;
} }
case SDLK_F10: case SDLK_F10:
{ {
gen_softreset(1);
gen_softreset(0); gen_softreset(0);
break; break;
} }
@ -385,17 +383,17 @@ static int sdl_control_update(SDLKey keystate)
case SDLK_F11: case SDLK_F11:
{ {
config.overscan ^= 1; config.overscan ^= 1;
bitmap.viewport.x = (config.overscan & 2) ? ((reg[12] & 1) ? 16 : 12) : 0; bitmap.viewport.changed = 3;
bitmap.viewport.y = (config.overscan & 1) ? (((reg[1] & 8) ? 0 : 8) + (vdp_pal ? 24 : 0)) : 0;
bitmap.viewport.changed = 1;
break; break;
} }
case SDLK_F12: case SDLK_F12:
{ {
joynum ++; while (input.dev[++joynum] == NO_DEVICE)
if (joynum > MAX_DEVICES - 1) {
joynum = 0; joynum = joynum % MAX_DEVICES;
}
joynum = joynum % MAX_DEVICES;
break; break;
} }
@ -460,8 +458,8 @@ int sdl_input_update(void)
int state = SDL_GetRelativeMouseState(&x,&y); int state = SDL_GetRelativeMouseState(&x,&y);
/* Sega Mouse range is -256;+256 */ /* Sega Mouse range is -256;+256 */
input.analog[2][0] = x; input.analog[2][0] = x * 2;
input.analog[2][1] = y; input.analog[2][1] = y * 2;
/* Vertical movement is upsidedown */ /* Vertical movement is upsidedown */
if (!config.invert_mouse) if (!config.invert_mouse)
@ -579,8 +577,7 @@ int main (int argc, char **argv)
bitmap.viewport.changed = 3; bitmap.viewport.changed = 3;
/* initialize emulation */ /* initialize emulation */
audio_init(SOUND_FREQUENCY, vdp_pal ? 50:60); audio_init(SOUND_FREQUENCY, vdp_pal ? 50.0 : 60.0);
//audio_init(SOUND_FREQUENCY, 1000000.0/16715.0);
system_init(); system_init();
/* load SRAM */ /* load SRAM */