Merge pull request #12 from Oggom/master

Sync with main repo
This commit is contained in:
Twinaphex 2014-11-26 03:21:31 +01:00
commit beefda4619
22 changed files with 422 additions and 245 deletions

View File

@ -44,7 +44,11 @@
#ifndef _MD_CART_H_
#define _MD_CART_H_
#ifdef USE_DYNAMIC_ALLOC
#define cart ext->md_cart
#else
#define cart ext.md_cart
#endif
/* Lock-On cartridge type */
#define TYPE_GG 0x01 /* Game Genie */

View File

@ -84,6 +84,7 @@ static const rominfo_t game_list[] =
/* games requiring 315-5124 VDP (Mark-III, Master System I) */
{0x32759751, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) */
{0xE8B82066, 0, 1, SYSTEM_GAMEPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Y's (J) [Demo] */
/* games requiring Sega 315-5235 mapper without bank shifting */
{0x23BAC434, 0, 0, SYSTEM_GAMEPAD, MAPPER_SEGA_X, SYSTEM_GG, REGION_USA}, /* Shining Force Gaiden - Final Conflict (JP) [T-Eng] */
@ -250,9 +251,9 @@ static const rominfo_t game_list[] =
{0x315917D4, 0, 0, SYSTEM_PADDLE, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Woody Pop */
/* games requiring Sega Sport Pad */
{0x41C948BF, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS, REGION_JAPAN_NTSC}, /* Sports Pad Soccer */
{0x0CB7E21F, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Great Ice Hockey */
{0xE42E4998, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Sports Pad Football */
{0x41C948BF, 0, 0, SYSTEM_SPORTSPAD, MAPPER_SEGA, SYSTEM_SMS2, REGION_USA}, /* Sports Pad Soccer */
/* games requiring Furrtek's Master Tap */
{0xFAB6F52F, 0, 0, SYSTEM_MASTERTAP, MAPPER_NONE, SYSTEM_SMS2, REGION_USA}, /* BOom (v1.0) */

View File

@ -44,7 +44,11 @@
#include "pcm.h"
#include "cd_cart.h"
#ifdef USE_DYNAMIC_ALLOC
#define scd ext->cd_hw
#else
#define scd ext.cd_hw
#endif
/* 5000000 SCD clocks/s = ~3184 clocks/line with a Master Clock of 53.693175 MHz */
/* This would be slightly (~30 clocks) more on PAL systems because of the slower */

View File

@ -41,7 +41,11 @@
#include "shared.h"
external_t ext; /* External Hardware (Cartridge, CD unit, ...) */
#ifdef USE_DYNAMIC_ALLOC
external_t *ext;
#else /* External Hardware (Cartridge, CD unit, ...) */
external_t ext;
#endif
uint8 boot_rom[0x800]; /* Genesis BOOT ROM */
uint8 work_ram[0x10000]; /* 68K RAM */
uint8 zram[0x2000]; /* Z80 RAM */
@ -345,11 +349,15 @@ void gen_reset(int hard_reset)
Z80.r = 4;
}
/* Master System specific (when BIOS is disabled) */
else if ((system_hw & SYSTEM_SMS) && (!(config.bios & 1) || !(system_bios & SYSTEM_SMS)))
/* Master System & Game Gear specific */
else if (system_hw & (SYSTEM_SMS | SYSTEM_GG))
{
/* usually done by BIOS & required by some SMS games that don't initialize SP */
Z80.sp.w.l = 0xDFFF;
/* check if BIOS is not being used */
if ((!(config.bios & 1) || !(system_bios & (SYSTEM_SMS | SYSTEM_GG))))
{
/* a few Master System (Ace of Aces, Shadow Dancer) & Game Gear (Ecco the Dolphin, Evander Holyfield Real Deal Boxing) games crash if SP is not properly initialized */
Z80.sp.w.l = 0xDFF0;
}
}
}
}

View File

@ -54,7 +54,11 @@ typedef union
} external_t;
/* Global variables */
#ifdef USE_DYNAMIC_ALLOC
extern external_t *ext;
#else
extern external_t ext;
#endif
extern uint8 boot_rom[0x800];
extern uint8 work_ram[0x10000];
extern uint8 zram[0x2000];

View File

@ -324,6 +324,12 @@ void io_reset(void)
/* Control registers */
io_reg[0x0E] = 0x00;
io_reg[0x0F] = 0xFF;
/* on SG-1000 & Mark-III, TH is not connected (always return 1) */
if (system_hw < SYSTEM_SMS)
{
io_reg[0x0F] = 0xF5;
}
}
/* Reset connected peripherals */
@ -412,12 +418,10 @@ unsigned int io_68k_read(unsigned int offset)
void io_z80_write(unsigned int offset, unsigned int data, unsigned int cycles)
{
/* I/O Control register */
if (offset)
{
/* I/O Control register */
if (region_code & REGION_USA)
{
/*
/*
Bit Function
--------------
D7 : Port B TH pin output level (1=high, 0=low)
@ -428,36 +432,33 @@ void io_z80_write(unsigned int offset, unsigned int data, unsigned int cycles)
D2 : Port B TR pin direction (1=input, 0=output)
D1 : Port A TH pin direction (1=input, 0=output)
D0 : Port A TR pin direction (1=input, 0=output)
*/
*/
/* Send TR/TH state to connected peripherals */
port[0].data_w((data << 1) & 0x60, (~io_reg[0x0F] << 5) & 0x60);
port[1].data_w((data >> 1) & 0x60, (~io_reg[0x0F] << 3) & 0x60);
/* Send TR/TH state to connected peripherals */
port[0].data_w((data << 1) & 0x60, (~data << 5) & 0x60);
port[1].data_w((data >> 1) & 0x60, (~data << 3) & 0x60);
/* Check for TH low-to-high transitions on both ports */
if ((!(io_reg[0x0F] & 0x80) && (data & 0x80)) ||
(!(io_reg[0x0F] & 0x20) && (data & 0x20)))
{
/* Latch new HVC */
hvc_latch = hctab[cycles % MCYCLES_PER_LINE] | 0x10000;
}
/* Update I/O Control register */
io_reg[0x0F] = data;
}
else
/* Japanese model specific */
if (region_code == REGION_JAPAN_NTSC)
{
/* TH output is fixed to 0 & TR is always an input on japanese hardware */
io_reg[0x0F] = (data | 0x05) & 0x5F;
/* Port $DD bits D4-D5 return D0-D2 (cf. http://www2.odn.ne.jp/~haf09260/Sms/EnrSms.htm) */
io_reg[0x0D] = ((data & 0x01) << 4) | ((data & 0x04) << 3);
/* Reading TH & TR pins always return 0 when set as output */
data &= 0x0F;
}
/* Check for TH low-to-high transitions on both ports */
if ((!(io_reg[0x0F] & 0x80) && (data & 0x80)) ||
(!(io_reg[0x0F] & 0x20) && (data & 0x20)))
{
/* Latch new HVC */
hvc_latch = hctab[cycles % MCYCLES_PER_LINE] | 0x10000;
}
/* Update I/O Control register */
io_reg[0x0F] = data;
}
else
{
/* Update Memory Control register */
/* Memory Control register */
io_reg[0x0E] = data;
/* Switch cartridge & BIOS ROM */

View File

@ -512,6 +512,8 @@ int load_bios(void)
default:
{
/* mark all BOOTROM as unloaded */
system_bios &= ~(0x10 | SYSTEM_SMS | SYSTEM_GG);
return 0;
}
}
@ -529,6 +531,14 @@ int load_rom(char *filename)
{
int i, size;
#ifdef USE_DYNAMIC_ALLOC
/* allocate memory for Cartridge /CD hardware buffer if required */
if (ext == NULL)
{
ext = (external_t *)malloc(sizeof(external_t));
}
#endif
/* clear any existing patches */
ggenie_shutdown();
areplay_shutdown();

View File

@ -251,9 +251,10 @@ void z80_md_port_w(unsigned int port, unsigned char data)
{
port &= 0xFF;
/* write FM chip if enabled */
if ((port >= 0xF0) && (config.ym2413 & 1))
{
fm_write(Z80.cycles, port&3, data);
fm_write(Z80.cycles, port, data);
return;
}
@ -299,7 +300,7 @@ unsigned char z80_md_port_r(unsigned int port)
/* read FM chip if enabled */
if ((port >= 0xF0) && (config.ym2413 & 1))
{
return YM2413Read(port & 3);
return YM2413Read();
}
return z80_unused_port_r(port);
@ -329,7 +330,7 @@ void z80_gg_port_w(unsigned int port, unsigned char data)
return;
}
z80_unused_port_w(port & 0xFF, data);
z80_unused_port_w(port, data);
return;
}
@ -431,13 +432,13 @@ void z80_ms_port_w(unsigned int port, unsigned char data)
case 0x01:
{
/* full address range is decoded by 315-5297 I/O chip (fixes Super Tetris / Power Boggle Boggle) */
if ((region_code == REGION_JAPAN_NTSC) && ((port & 0xFE) != 0x3E))
if ((region_code != REGION_JAPAN_NTSC) || ((port & 0xFE) == 0x3E))
{
z80_unused_port_w(port & 0xFF, data);
io_z80_write(port & 1, data, Z80.cycles + SMS_CYCLE_OFFSET);
return;
}
io_z80_write(port & 1, data, Z80.cycles + SMS_CYCLE_OFFSET);
z80_unused_port_w(port & 0xFF, data);
return;
}
@ -462,9 +463,17 @@ void z80_ms_port_w(unsigned int port, unsigned char data)
default:
{
/* write FM chip if enabled */
if (!(port & 4) && (config.ym2413 & 1))
{
fm_write(Z80.cycles, port & 3, data);
fm_write(Z80.cycles, port, data);
/* 315-5297 I/O chip decodes bit 1 to enable/disable PSG output */
if (region_code == REGION_JAPAN_NTSC)
{
io_reg[6] = (data & 2) ? 0xFF : 0x00;
SN76489_Config(Z80.cycles, config.psg_preamp, config.psgBoostNoise, io_reg[6]);
}
return;
}
@ -506,27 +515,27 @@ unsigned char z80_ms_port_r(unsigned int port)
default:
{
uint8 data = 0xFF;
/* read FM chip if enabled */
if (!(port & 4) && (config.ym2413 & 1))
{
/* check if I/O ports are disabled */
if (io_reg[0x0E] & 0x04)
data = YM2413Read();
/* 315-5297 I/O chip decodes full address range */
if (region_code == REGION_JAPAN_NTSC)
{
return YM2413Read(port & 3);
}
else
{
return YM2413Read(port & 3) & io_z80_read(port & 1);
return data;
}
}
/* check if I/O ports are enabled */
/* read I/O ports if enabled */
if (!(io_reg[0x0E] & 0x04))
{
return io_z80_read(port & 1);
data &= io_z80_read(port & 1);
}
return z80_unused_port_r(port & 0xFF);
return data;
}
}
}
@ -543,7 +552,7 @@ void z80_m3_port_w(unsigned int port, unsigned char data)
case 0x00:
case 0x01:
{
z80_unused_port_w(port, data);
z80_unused_port_w(port & 0xFF, data);
return;
}
@ -568,9 +577,10 @@ void z80_m3_port_w(unsigned int port, unsigned char data)
default:
{
/* write FM chip if enabled */
if (!(port & 4) && (config.ym2413 & 1))
{
fm_write(Z80.cycles, port & 3, data);
fm_write(Z80.cycles, port, data);
return;
}
@ -615,8 +625,8 @@ unsigned char z80_m3_port_r(unsigned int port)
/* read FM chip if enabled */
if (!(port & 4) && (config.ym2413 & 1))
{
/* I/O ports are automatically disabled */
return YM2413Read(port & 3);
/* I/O ports are automatically disabled by hardware */
return YM2413Read();
}
/* read I/O ports */
@ -638,6 +648,9 @@ void z80_sg_port_w(unsigned int port, unsigned char data)
case 0x41:
{
SN76489_Write(Z80.cycles, data);
/* Z80 !WAIT input is tied to SN76489AN chip READY pin (held low for 32 clocks after each write access) */
Z80.cycles += (32 * 15);
return;
}
@ -683,7 +696,7 @@ unsigned char z80_sg_port_r(unsigned int port)
default:
{
return z80_unused_port_r(port);
return z80_unused_port_r(port & 0xFF);
}
}
}

View File

@ -111,6 +111,7 @@ void sound_reset(void)
/* reset sound chips */
YM_Reset();
SN76489_Reset();
SN76489_Config(0, config.psg_preamp, config.psgBoostNoise, 0xff);
/* reset FM buffer ouput */
fm_last[0] = fm_last[1] = 0;

View File

@ -1658,14 +1658,14 @@ void YM2413Write(unsigned int a, unsigned int v)
}
else
{
/* latched bit (Master System specific) */
/* bit 0 enable/disable FM output (Master System / Mark-III FM adapter specific) */
ym2413.status = v & 0x01;
}
}
unsigned int YM2413Read(unsigned int a)
unsigned int YM2413Read(void)
{
/* D0=latched bit, D1-D2 need to be zero (Master System specific) */
/* bit 0 returns latched FM enable status, bits 1-2 return zero (Master System / Mark-III FM adapter specific) */
return 0xF8 | ym2413.status;
}

View File

@ -16,7 +16,7 @@ extern void YM2413Init(void);
extern void YM2413ResetChip(void);
extern void YM2413Update(int *buffer, int length);
extern void YM2413Write(unsigned int a, unsigned int v);
extern unsigned int YM2413Read(unsigned int a);
extern unsigned int YM2413Read(void);
extern unsigned char *YM2413GetContextPtr(void);
extern unsigned int YM2413GetContextSize(void);

View File

@ -4176,8 +4176,8 @@ void remap_line(int line)
line = (line * 2) + odd_frame;
}
/* NTSC Filter (only supported for 15 or 16-bit pixels rendering) */
#if defined(USE_15BPP_RENDERING) || defined(USE_16BPP_RENDERING)
/* NTSC Filter (only supported for 15 or 16-bit pixels rendering) */
if (config.ntsc)
{
if (reg[12] & 0x01)
@ -4192,16 +4192,27 @@ void remap_line(int line)
else
#endif
{
/* Convert VDP pixel data to output pixel format */
#ifdef CUSTOM_BLITTER
CUSTOM_BLITTER(line, width, pixel, src)
#else
PIXEL_OUT_T *dst =((PIXEL_OUT_T *)&bitmap.data[(line * bitmap.pitch)]);
do
/* Convert VDP pixel data to output pixel format */
PIXEL_OUT_T *dst = ((PIXEL_OUT_T *)&bitmap.data[(line * bitmap.pitch)]);
if (config.lcd)
{
*dst++ = pixel[*src++];
do
{
RENDER_PIXEL_LCD(src,dst,pixel,config.lcd);
}
while (--width);
}
while (--width);
#endif
else
{
do
{
*dst++ = pixel[*src++];
}
while (--width);
}
#endif
}
}

View File

@ -42,6 +42,55 @@
#ifndef _RENDER_H_
#define _RENDER_H_
/* 3:3:2 RGB */
#if defined(USE_8BPP_RENDERING)
#define PIXEL(r,g,b) (((r) << 5) | ((g) << 2) | (b))
#define GET_R(pixel) (((pixel) & 0xe0) >> 5)
#define GET_G(pixel) (((pixel) & 0x1c) >> 2)
#define GET_B(pixel) (((pixel) & 0x03) >> 0)
/* 5:5:5 RGB */
#elif defined(USE_15BPP_RENDERING)
#define PIXEL(r,g,b) ((1 << 15) | ((r) << 10) | ((g) << 5) | (b))
#define GET_R(pixel) (((pixel) & 0x7c00) >> 10)
#define GET_G(pixel) (((pixel) & 0x03e0) >> 5)
#define GET_B(pixel) (((pixel) & 0x001f) >> 0)
/* 5:6:5 RGB */
#elif defined(USE_16BPP_RENDERING)
#define PIXEL(r,g,b) (((r) << 11) | ((g) << 5) | (b))
#define GET_R(pixel) (((pixel) & 0xf800) >> 11)
#define GET_G(pixel) (((pixel) & 0x07e0) >> 5)
#define GET_B(pixel) (((pixel) & 0x001f) >> 0)
/* 8:8:8 RGB */
#elif defined(USE_32BPP_RENDERING)
#define PIXEL(r,g,b) ((0xff << 24) | ((r) << 16) | ((g) << 8) | (b))
#define GET_R(pixel) (((pixel) & 0xff0000) >> 16)
#define GET_G(pixel) (((pixel) & 0x00ff00) >> 8)
#define GET_B(pixel) (((pixel) & 0x0000ff) >> 0)
#endif
/* LCD image persistence (ghosting) filter */
/* Simulates (roughly) the slow decay response time of passive-matrix LCD */
/* Rate value is formatted as 0.8 fixed-point integer (between 0.0 and 0.99609375), a higher value meaning a slower decay */
/* Required for proper display of some effects in a few Game Gear games (James Pond 3, Power Drift, Super Monaco GP II,...) */
#define RENDER_PIXEL_LCD(in,out,table,rate) \
{ \
PIXEL_OUT_T pixel_out = table[*in++]; \
PIXEL_OUT_T pixel_old = *out; \
uint8 r = GET_R(pixel_out); \
uint8 g = GET_G(pixel_out); \
uint8 b = GET_B(pixel_out); \
int r_decay = GET_R(pixel_old) - r; \
int g_decay = GET_G(pixel_old) - g; \
int b_decay = GET_B(pixel_old) - b; \
if (r_decay > 0) r += (rate * r_decay) >> 8; \
if (g_decay > 0) g += (rate * g_decay) >> 8; \
if (b_decay > 0) b += (rate * b_decay) >> 8; \
*out++ = PIXEL(r,g,b); \
}
/* Global variables */
extern uint16 spr_col;

View File

@ -132,6 +132,7 @@ void config_default(void)
config.aspect = 1;
config.overscan = 3; /* FULL */
config.gg_extra = 0;
config.lcd = 0;
config.ntsc = 0;
config.vsync = 1; /* AUTO */
config.bilinear = 0;

View File

@ -57,12 +57,12 @@ typedef struct
uint8 mono;
int16 psg_preamp;
int16 fm_preamp;
uint32 lp_range;
int16 low_freq;
int16 high_freq;
int16 lg;
int16 mg;
int16 hg;
uint32 lp_range;
uint8 system;
uint8 region_detect;
uint8 master_clock;
@ -76,6 +76,7 @@ typedef struct
uint8 gun_cursor[2];
uint8 overscan;
uint8 gg_extra;
uint8 lcd;
uint8 ntsc;
uint8 vsync;
uint8 render;
@ -88,7 +89,7 @@ typedef struct
int16 xscale;
int16 yscale;
#ifdef HW_RVL
uint32 trap;
uint8 trap;
float gamma;
#else
uint8 v_prog;

View File

@ -225,7 +225,7 @@ static gui_item action_select =
/*****************************************************************************/
/* GUI backgrounds images */
/*****************************************************************************/
static gui_image bg_main[4] =
static gui_image bg_main[] =
{
{NULL,Bg_layer_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
{NULL,Bg_overlay_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
@ -233,7 +233,7 @@ static gui_image bg_main[4] =
{NULL,Main_logo_png,IMAGE_VISIBLE|IMAGE_SLIDE_BOTTOM,202,362,232,56,255}
};
static gui_image bg_misc[5] =
static gui_image bg_misc[] =
{
{NULL,Bg_layer_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
{NULL,Bg_overlay_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
@ -242,7 +242,7 @@ static gui_image bg_misc[5] =
{NULL,Main_logo_png,IMAGE_VISIBLE|IMAGE_SLIDE_TOP,466,40,152,44,255}
};
static gui_image bg_ctrls[8] =
static gui_image bg_ctrls[] =
{
{NULL,Bg_layer_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
{NULL,Bg_overlay_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
@ -254,7 +254,7 @@ static gui_image bg_ctrls[8] =
{NULL,Frame_s3_png,IMAGE_SLIDE_RIGHT,400,134,292,248,128}
};
static gui_image bg_list[6] =
static gui_image bg_list[] =
{
{NULL,Bg_layer_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
{NULL,Bg_overlay_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
@ -264,7 +264,7 @@ static gui_image bg_list[6] =
{NULL,Frame_s1_png,IMAGE_VISIBLE,8,70,372,336,76}
};
static gui_image bg_saves[8] =
static gui_image bg_saves[] =
{
{NULL,NULL,0,0,0,0,0,255},
{NULL,Bg_layer_png,IMAGE_VISIBLE|IMAGE_REPEAT,0,0,640,480,255},
@ -281,7 +281,7 @@ static gui_image bg_saves[8] =
/*****************************************************************************/
/* Main menu */
static gui_item items_main[10] =
static gui_item items_main[] =
{
{NULL,Main_load_png ,"","",114,162,80,92},
{NULL,Main_options_png ,"","",290,166,60,88},
@ -300,7 +300,7 @@ static gui_item items_main[10] =
};
/* Controllers menu */
static gui_item items_ctrls[13] =
static gui_item items_ctrls[] =
{
{NULL,NULL,"","", 0, 0, 0, 0},
{NULL,NULL,"","", 0, 0, 0, 0},
@ -318,7 +318,7 @@ static gui_item items_ctrls[13] =
};
/* Load menu */
static gui_item items_load[6] =
static gui_item items_load[] =
{
{NULL,Load_recent_png,"","Load recently played games", 119,144,72, 92},
{NULL,Load_md_png, "","Load Mega Drive/Genesis games", 278,141,84, 92},
@ -329,7 +329,7 @@ static gui_item items_load[6] =
};
/* Option menu */
static gui_item items_options[5] =
static gui_item items_options[] =
{
{NULL,Option_system_png,"","System settings", 114,142,80,92},
{NULL,Option_video_png, "","Video settings", 288,150,64,84},
@ -339,7 +339,7 @@ static gui_item items_options[5] =
};
/* Audio options */
static gui_item items_audio[13] =
static gui_item items_audio[] =
{
{NULL,NULL,"Master System FM: AUTO", "Enable/disable YM2413 chip", 56,132,276,48},
{NULL,NULL,"High-Quality FM: ON", "Adjust YM2612/YM2413 resampling quality", 56,132,276,48},
@ -357,7 +357,7 @@ static gui_item items_audio[13] =
};
/* System ROM paths */
static gui_item items_rompaths[12] =
static gui_item items_rompaths[] =
{
{NULL,NULL,"CD BIOS (USA): NOT FOUND", "Select Sega CD (USA) BIOS", 56,132,276,48},
{NULL,NULL,"CD BIOS (PAL): NOT FOUND", "Select Mega CD (PAL) BIOS", 56,132,276,48},
@ -374,7 +374,7 @@ static gui_item items_rompaths[12] =
};
/* System options */
static gui_item items_system[11] =
static gui_item items_system[] =
{
{NULL,NULL,"Console Hardware: AUTO", "Select system hardware model", 56,132,276,48},
{NULL,NULL,"Console Region: AUTO", "Select system region", 56,132,276,48},
@ -390,40 +390,33 @@ static gui_item items_system[11] =
};
/* Video options */
#ifdef HW_RVL
static gui_item items_video[18] =
#else
static gui_item items_video[16] =
#endif
static gui_item items_video[] =
{
{NULL,NULL,"Display: PROGRESSIVE", "Select video mode", 56,132,276,48},
{NULL,NULL,"TV mode: 50/60HZ", "Select video refresh rate", 56,132,276,48},
{NULL,NULL,"VSYNC: AUTO", "Enable/disable sync with Video Hardware", 56,132,276,48},
{NULL,NULL,"GX Bilinear Filter: OFF", "Enable/disable texture hardware filtering", 56,132,276,48},
{NULL,NULL,"GX Deflickering Filter: OFF","Enable/disable GX hardware filtering", 56,132,276,48},
{NULL,NULL,"Display: PROGRESSIVE", "Select video mode", 56,132,276,48},
{NULL,NULL,"TV mode: 50/60HZ", "Select video refresh rate", 56,132,276,48},
{NULL,NULL,"VSYNC: AUTO", "Enable/disable sync with video hardware", 56,132,276,48},
{NULL,NULL,"GX Bilinear Filter: OFF", "Enable/disable hardware texture filtering", 56,132,276,48},
{NULL,NULL,"GX Deflickering Filter: OFF", "Enable/disable hardware GX filtering", 56,132,276,48},
#ifdef HW_RVL
{NULL,NULL,"VI Trap Filter: ON", "Enable/disable video hardware filtering", 56,132,276,48},
{NULL,NULL,"VI Gamma Correction: 1.0", "Adjust video hardware gamma correction", 56,132,276,48},
{NULL,NULL,"VI Trap Filter: ON", "Enable/disable hardware composite video filtering", 56,132,276,48},
{NULL,NULL,"VI Gamma Correction: 1.0", "Adjust video hardware gamma correction", 56,132,276,48},
#endif
{NULL,NULL,"NTSC Filter: COMPOSITE", "Enable/disable NTSC software filtering", 56,132,276,48},
{NULL,NULL,"NTSC Sharpness: 0.0", "Adjust edge contrast enhancement/blurring", 56,132,276,48},
{NULL,NULL,"NTSC Resolution: 0.0", "Adjust image resolution", 56,132,276,48},
{NULL,NULL,"NTSC Artifacts: 0.0", "Adjust artifacts caused by color changes", 56,132,276,48},
{NULL,NULL,"NTSC Color Bleed: 0.0", "Adjust color resolution reduction", 56,132,276,48},
{NULL,NULL,"NTSC Color Fringing: 0.0", "Adjust artifacts caused by brightness changes", 56,132,276,48},
{NULL,NULL,"Borders: OFF", "Enable/disable overscan emulation", 56,132,276,48},
{NULL,NULL,"GG screen: ORIGINAL", "Enable/disable Game Gear extended screen", 56,132,276,48},
{NULL,NULL,"Aspect: ORIGINAL (4:3)", "Select display aspect ratio", 56,132,276,48},
{NULL,NULL,"Screen Position (+0,+0)", "Adjust display position", 56,132,276,48},
{NULL,NULL,"Screen Scaling (+0,+0)", "Adjust display scaling", 56,132,276,48}
{NULL,NULL,"LCD Ghosting Filter: OFF", "Enable/disable software LCD image persistence", 56,132,276,48},
{NULL,NULL,"NTSC Filter: COMPOSITE", "Enable/disable software NTSC filtering", 56,132,276,48},
{NULL,NULL,"NTSC Sharpness: 0.0", "Adjust edge contrast enhancement/blurring", 56,132,276,48},
{NULL,NULL,"NTSC Resolution: 0.0", "Adjust image resolution", 56,132,276,48},
{NULL,NULL,"NTSC Artifacts: 0.0", "Adjust artifacts caused by color changes", 56,132,276,48},
{NULL,NULL,"NTSC Color Bleed: 0.0", "Adjust color resolution reduction", 56,132,276,48},
{NULL,NULL,"NTSC Color Fringing: 0.0", "Adjust artifacts caused by brightness changes", 56,132,276,48},
{NULL,NULL,"Borders: OFF", "Enable/disable overscan emulation", 56,132,276,48},
{NULL,NULL,"GG screen: ORIGINAL", "Enable/disable Game Gear extended screen", 56,132,276,48},
{NULL,NULL,"Aspect: ORIGINAL (4:3)", "Select display aspect ratio", 56,132,276,48},
{NULL,NULL,"Screen Position (+0,+0)", "Adjust display position", 56,132,276,48},
{NULL,NULL,"Screen Scaling (+0,+0)", "Adjust display scaling", 56,132,276,48}
};
/* Menu options */
#ifdef HW_RVL
static gui_item items_prefs[13] =
#else
static gui_item items_prefs[11] =
#endif
static gui_item items_prefs[] =
{
{NULL,NULL,"Auto ROM Load: OFF", "Enable/disable automatic ROM loading on startup", 56,132,276,48},
{NULL,NULL,"Auto Cheats: OFF", "Enable/disable automatic cheats activation", 56,132,276,48},
@ -443,7 +436,7 @@ static gui_item items_prefs[11] =
};
/* Save Manager */
static gui_item items_saves[9] =
static gui_item items_saves[] =
{
{NULL,NULL,"","" ,0,0,0,0},
{NULL,NULL,"","" ,0,0,0,0},
@ -465,7 +458,7 @@ static gui_butn arrow_up = {&arrow_up_data,BUTTON_ACTIVE|BUTTON_OVER_SFX,{0,0,0,
static gui_butn arrow_down = {&arrow_down_data,BUTTON_ACTIVE|BUTTON_OVER_SFX,{0,0,0,0},14,368,360,32};
/* Generic list menu */
static gui_butn buttons_list[4] =
static gui_butn buttons_list[] =
{
{&button_text_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX,{1,1,0,0},56,132,276,48},
{&button_text_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX,{1,1,0,0},56,188,276,48},
@ -474,7 +467,7 @@ static gui_butn buttons_list[4] =
};
/* Main menu */
static gui_butn buttons_main[10] =
static gui_butn buttons_main[] =
{
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,0,0,1}, 80,140,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,0,1,1},246,140,148,132},
@ -489,7 +482,7 @@ static gui_butn buttons_main[10] =
};
/* Controllers Menu */
static gui_butn buttons_ctrls[13] =
static gui_butn buttons_ctrls[] =
{
{&button_icon_data ,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX ,{0,1,0,2}, 60, 88,148,132},
{&button_icon_data ,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX ,{1,0,0,5}, 60,258,148,132},
@ -507,7 +500,7 @@ static gui_butn buttons_ctrls[13] =
};
/* Load Game menu */
static gui_butn buttons_load[6] =
static gui_butn buttons_load[] =
{
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,0,1}, 80,120,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,1,1},246,120,148,132},
@ -518,7 +511,7 @@ static gui_butn buttons_load[6] =
};
/* Options menu */
static gui_butn buttons_options[5] =
static gui_butn buttons_options[] =
{
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,0,1}, 80,120,148,132},
{&button_icon_data,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX|BUTTON_SELECT_SFX,{0,3,1,1},246,120,148,132},
@ -528,7 +521,7 @@ static gui_butn buttons_options[5] =
};
/* Save Manager Menu */
static gui_butn buttons_saves[9] =
static gui_butn buttons_saves[] =
{
{&button_text_data ,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX,{0,1,0,0}, 56,102,276,48},
{&button_text_data ,BUTTON_VISIBLE|BUTTON_ACTIVE|BUTTON_OVER_SFX,{1,1,0,0}, 56,158,276,48},
@ -620,7 +613,7 @@ static gui_menu menu_system =
{
"System Settings",
0,0,
10,4,6,0,
0,4,6,0,
items_system,
buttons_list,
bg_list,
@ -634,7 +627,7 @@ static gui_menu menu_video =
{
"Video Settings",
0,0,
10,4,6,0,
0,4,6,0,
items_video,
buttons_list,
bg_list,
@ -648,7 +641,7 @@ static gui_menu menu_audio =
{
"Audio Settings",
0,0,
9,4,6,0,
0,4,6,0,
items_audio,
buttons_list,
bg_list,
@ -662,7 +655,7 @@ static gui_menu menu_prefs =
{
"Menu Settings",
0,0,
12,4,6,0,
0,4,6,0,
items_prefs,
buttons_list,
bg_list,
@ -1078,7 +1071,7 @@ static void soundmenu ()
if (config.filter == 1)
{
int16 lp_range = (config.lp_range * 100 + 0xffff) / 0x10000;
GUI_OptionBox(m,0,"Low-Pass Rate",(void *)&lp_range,1,0,100,1);
GUI_OptionBox(m,0,"Low-Pass Rate (%)",(void *)&lp_range,1,0,100,1);
sprintf (items[8].text, "Low-Pass Rate: %d %%", lp_range);
config.lp_range = (lp_range * 0x10000) / 100;
}
@ -1335,7 +1328,7 @@ static void systemmenu ()
/* Default system hardware (auto) */
if (system_hw) system_hw = romtype;
}
}
else if (config.system == 0)
{
config.system = SYSTEM_SG;
@ -1694,65 +1687,75 @@ static void videomenu ()
sprintf (items[6].text, "VI Gamma Correction: %1.1f", config.gamma);
#endif
if (config.lcd > 0)
{
int ratio = ((config.lcd * 100) + 254) / 255;
sprintf (items[VI_OFFSET].text, "LCD Ghosting Filter: %d%%", ratio);
}
else
{
sprintf (items[VI_OFFSET].text, "LCD Ghosting Filter: OFF");
}
if (config.ntsc == 1)
sprintf (items[VI_OFFSET].text, "NTSC Filter: COMPOSITE");
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: COMPOSITE");
else if (config.ntsc == 2)
sprintf (items[VI_OFFSET].text, "NTSC Filter: S-VIDEO");
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: S-VIDEO");
else if (config.ntsc == 3)
sprintf (items[VI_OFFSET].text, "NTSC Filter: RGB");
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: RGB");
else if (config.ntsc == 4)
{
sprintf (items[VI_OFFSET].text, "NTSC Filter: MANUAL");
sprintf(items[VI_OFFSET+1].text, "NTSC Sharpness: %1.2f", config.ntsc_sharpness);
sprintf(items[VI_OFFSET+2].text, "NTSC Resolution: %1.2f", config.ntsc_resolution);
sprintf(items[VI_OFFSET+3].text, "NTSC Artifacts: %1.2f", config.ntsc_artifacts);
sprintf(items[VI_OFFSET+4].text, "NTSC Color Bleed: %1.2f", config.ntsc_bleed);
sprintf(items[VI_OFFSET+5].text, "NTSC Color Fringing: %1.2f", config.ntsc_fringing);
strcpy(items[VI_OFFSET+1].comment, "Adjust edge contrast enhancement/blurring");
strcpy(items[VI_OFFSET+2].comment, "Adjust image resolution");
strcpy(items[VI_OFFSET+3].comment, "Adjust artifacts caused by color changes");
strcpy(items[VI_OFFSET+4].comment, "Adjust color resolution reduction");
strcpy(items[VI_OFFSET+5].comment, "Adjust artifacts caused by brightness changes");
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: MANUAL");
sprintf(items[VI_OFFSET+2].text, "NTSC Sharpness: %1.2f", config.ntsc_sharpness);
sprintf(items[VI_OFFSET+3].text, "NTSC Resolution: %1.2f", config.ntsc_resolution);
sprintf(items[VI_OFFSET+4].text, "NTSC Artifacts: %1.2f", config.ntsc_artifacts);
sprintf(items[VI_OFFSET+5].text, "NTSC Color Bleed: %1.2f", config.ntsc_bleed);
sprintf(items[VI_OFFSET+6].text, "NTSC Color Fringing: %1.2f", config.ntsc_fringing);
strcpy(items[VI_OFFSET+2].comment, "Adjust edge contrast enhancement/blurring");
strcpy(items[VI_OFFSET+3].comment, "Adjust image resolution");
strcpy(items[VI_OFFSET+4].comment, "Adjust artifacts caused by color changes");
strcpy(items[VI_OFFSET+5].comment, "Adjust color resolution reduction");
strcpy(items[VI_OFFSET+6].comment, "Adjust artifacts caused by brightness changes");
ntsc_offset = 5;
}
else
sprintf (items[VI_OFFSET].text, "NTSC Filter: OFF");
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: OFF");
strcpy(items[VI_OFFSET+1+ntsc_offset].comment, "Enable/disable overscan emulation");
strcpy(items[VI_OFFSET+2+ntsc_offset].comment, "Enable/disable Game Gear extended screen");
strcpy(items[VI_OFFSET+3+ntsc_offset].comment, "Select display aspect ratio");
strcpy(items[VI_OFFSET+4+ntsc_offset].comment, "Adjust display position");
strcpy(items[VI_OFFSET+5+ntsc_offset].comment, "Adjust display scaling");
strcpy(items[VI_OFFSET+2+ntsc_offset].comment, "Enable/disable overscan emulation");
strcpy(items[VI_OFFSET+3+ntsc_offset].comment, "Enable/disable Game Gear extended screen");
strcpy(items[VI_OFFSET+4+ntsc_offset].comment, "Select display aspect ratio");
strcpy(items[VI_OFFSET+5+ntsc_offset].comment, "Adjust display position");
strcpy(items[VI_OFFSET+6+ntsc_offset].comment, "Adjust display scaling");
if (config.overscan == 3)
sprintf (items[VI_OFFSET+1+ntsc_offset].text, "Borders: FULL");
sprintf (items[VI_OFFSET+2+ntsc_offset].text, "Borders: FULL");
else if (config.overscan == 2)
sprintf (items[VI_OFFSET+1+ntsc_offset].text, "Borders: H ONLY");
sprintf (items[VI_OFFSET+2+ntsc_offset].text, "Borders: H ONLY");
else if (config.overscan == 1)
sprintf (items[VI_OFFSET+1+ntsc_offset].text, "Borders: V ONLY");
sprintf (items[VI_OFFSET+2+ntsc_offset].text, "Borders: V ONLY");
else
sprintf (items[VI_OFFSET+1+ntsc_offset].text, "Borders: NONE");
sprintf (items[VI_OFFSET+2+ntsc_offset].text, "Borders: NONE");
sprintf(items[VI_OFFSET+2+ntsc_offset].text, "GG Screen: %s", config.gg_extra ? "EXTENDED":"ORIGINAL");
sprintf(items[VI_OFFSET+3+ntsc_offset].text, "GG Screen: %s", config.gg_extra ? "EXTENDED":"ORIGINAL");
if (config.aspect == 1)
sprintf (items[VI_OFFSET+3+ntsc_offset].text,"Aspect: ORIGINAL (4:3)");
sprintf (items[VI_OFFSET+4+ntsc_offset].text,"Aspect: ORIGINAL (4:3)");
else if (config.aspect == 2)
sprintf (items[VI_OFFSET+3+ntsc_offset].text, "Aspect: ORIGINAL (16:9)");
sprintf (items[VI_OFFSET+4+ntsc_offset].text, "Aspect: ORIGINAL (16:9)");
else
{
sprintf (items[VI_OFFSET+3+ntsc_offset].text, "Aspect: SCALED");
sprintf (items[VI_OFFSET+4+ntsc_offset].text, "Aspect: SCALED");
}
sprintf (items[VI_OFFSET+4+ntsc_offset].text, "Screen Position: (%s%02d,%s%02d)",
sprintf (items[VI_OFFSET+5+ntsc_offset].text, "Screen Position: (%s%02d,%s%02d)",
(config.xshift < 0) ? "":"+", config.xshift,
(config.yshift < 0) ? "":"+", config.yshift);
sprintf (items[VI_OFFSET+5+ntsc_offset].text, "Screen Scaling: (%s%02d,%s%02d)",
sprintf (items[VI_OFFSET+6+ntsc_offset].text, "Screen Scaling: (%s%02d,%s%02d)",
(config.xscale < 0) ? "":"+", config.xscale,
(config.yscale < 0) ? "":"+", config.yscale);
m->max_items = VI_OFFSET + 5 + ntsc_offset + (config.aspect == 0);
m->max_items = VI_OFFSET + 6 + ntsc_offset + (config.aspect == 0);
GUI_InitMenu(m);
GUI_SlideMenuTitle(m,strlen("Video "));
@ -1761,7 +1764,7 @@ static void videomenu ()
{
ret = GUI_RunMenu(m);
if (ret > VI_OFFSET)
if (ret > (VI_OFFSET + 1))
{
ret += (5 - ntsc_offset);
}
@ -1769,6 +1772,7 @@ static void videomenu ()
switch (ret)
{
case 0: /*** rendering ***/
{
config.render = (config.render + 1) % 3;
if (config.render == 2)
{
@ -1784,10 +1788,13 @@ static void videomenu ()
sprintf (items[0].text, "Display: PROGRESSIVE");
else
sprintf (items[0].text, "Display: ORIGINAL");
reinit = 1;
break;
}
case 1: /*** tv mode ***/
{
config.tv_mode = (config.tv_mode + 1) % 3;
if (config.tv_mode == 0)
sprintf (items[1].text, "TV Mode: 60HZ");
@ -1797,8 +1804,10 @@ static void videomenu ()
sprintf (items[1].text, "TV Mode: 50/60HZ");
reinit = 1;
break;
}
case 2: /*** VSYNC ***/
{
config.vsync ^= 1;
if (config.vsync)
sprintf (items[2].text, "VSYNC: AUTO");
@ -1806,24 +1815,32 @@ static void videomenu ()
sprintf (items[2].text, "VSYNC: OFF");
reinit = 1;
break;
}
case 3: /*** GX Texture filtering ***/
{
config.bilinear ^= 1;
sprintf (items[3].text, "GX Bilinear Filter: %s", config.bilinear ? " ON" : "OFF");
break;
}
case 4: /*** GX Copy filtering (deflickering filter) ***/
{
config.vfilter ^= 1;
sprintf (items[4].text, "GX Deflicker Filter: %s", config.vfilter ? " ON" : "OFF");
break;
}
#ifdef HW_RVL
case 5: /*** VIDEO Trap filtering ***/
{
config.trap ^= 1;
sprintf (items[5].text, "VI Trap Filter: %s", config.trap ? " ON" : "OFF");
break;
}
case 6: /*** VIDEO Gamma correction ***/
{
if (system_hw)
{
update_gamma();
@ -1851,138 +1868,175 @@ static void videomenu ()
GUI_WaitPrompt("Error","Please load a game first !\n");
}
break;
}
#endif
case VI_OFFSET: /*** NTSC filter ***/
case VI_OFFSET: /*** LCD filter (soft) ***/
{
if (config.ntsc)
{
GUI_WaitPrompt("Error","NTSC filter must be disabled\n");
break;
}
int16 ratio = ((config.lcd * 100) + 254) / 255;
GUI_OptionBox(m,0,"LCD Ghosting Ratio (%)",(void *)&ratio,1,0,100,1);
if (ratio > 0)
{
sprintf (items[VI_OFFSET].text, "LCD Ghosting Filter: %d%%", ratio);
}
else
{
sprintf (items[VI_OFFSET].text, "LCD Ghosting Filter: OFF");
}
config.lcd = (ratio * 255) / 100;
break;
}
case VI_OFFSET+1: /*** NTSC filter (soft) ***/
{
if (config.lcd)
{
GUI_WaitPrompt("Error","LCD filter must be disabled\n");
break;
}
config.ntsc = (config.ntsc + 1) % 5;
if (config.ntsc == 1)
{
sprintf (items[VI_OFFSET].text, "NTSC Filter: COMPOSITE");
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: COMPOSITE");
}
else if (config.ntsc == 2)
{
sprintf (items[VI_OFFSET].text, "NTSC Filter: S-VIDEO");
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: S-VIDEO");
}
else if (config.ntsc == 3)
{
sprintf (items[VI_OFFSET].text, "NTSC Filter: RGB");
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: RGB");
}
else if (config.ntsc == 4)
{
sprintf (items[VI_OFFSET].text, "NTSC Filter: MANUAL");
strcpy(items[VI_OFFSET+5+1].text, items[VI_OFFSET+1].text);
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: MANUAL");
strcpy(items[VI_OFFSET+5+2].text, items[VI_OFFSET+2].text);
strcpy(items[VI_OFFSET+5+3].text, items[VI_OFFSET+3].text);
strcpy(items[VI_OFFSET+5+4].text, items[VI_OFFSET+4].text);
strcpy(items[VI_OFFSET+5+5].text, items[VI_OFFSET+5].text);
strcpy(items[VI_OFFSET+5+1].comment, items[VI_OFFSET+1].comment);
strcpy(items[VI_OFFSET+5+6].text, items[VI_OFFSET+6].text);
strcpy(items[VI_OFFSET+5+2].comment, items[VI_OFFSET+2].comment);
strcpy(items[VI_OFFSET+5+3].comment, items[VI_OFFSET+3].comment);
strcpy(items[VI_OFFSET+5+4].comment, items[VI_OFFSET+4].comment);
strcpy(items[VI_OFFSET+5+5].comment, items[VI_OFFSET+5].comment);
sprintf(items[VI_OFFSET+1].text, "NTSC Sharpness: %1.1f", config.ntsc_sharpness);
sprintf(items[VI_OFFSET+2].text, "NTSC Resolution: %1.1f", config.ntsc_resolution);
sprintf(items[VI_OFFSET+3].text, "NTSC Artifacts: %1.1f", config.ntsc_artifacts);
sprintf(items[VI_OFFSET+4].text, "NTSC Color Bleed: %1.1f", config.ntsc_bleed);
sprintf(items[VI_OFFSET+5].text, "NTSC Color Fringing: %1.1f", config.ntsc_fringing);
strcpy(items[VI_OFFSET+1].comment, "Adjust edge contrast enhancement/blurring");
strcpy(items[VI_OFFSET+2].comment, "Adjust image resolution");
strcpy(items[VI_OFFSET+3].comment, "Adjust artifacts caused by color changes");
strcpy(items[VI_OFFSET+4].comment, "Adjust color resolution reduction");
strcpy(items[VI_OFFSET+5].comment, "Adjust artifacts caused by brightness changes");
strcpy(items[VI_OFFSET+5+6].comment, items[VI_OFFSET+6].comment);
sprintf(items[VI_OFFSET+2].text, "NTSC Sharpness: %1.1f", config.ntsc_sharpness);
sprintf(items[VI_OFFSET+3].text, "NTSC Resolution: %1.1f", config.ntsc_resolution);
sprintf(items[VI_OFFSET+4].text, "NTSC Artifacts: %1.1f", config.ntsc_artifacts);
sprintf(items[VI_OFFSET+5].text, "NTSC Color Bleed: %1.1f", config.ntsc_bleed);
sprintf(items[VI_OFFSET+6].text, "NTSC Color Fringing: %1.1f", config.ntsc_fringing);
strcpy(items[VI_OFFSET+2].comment, "Adjust edge contrast enhancement/blurring");
strcpy(items[VI_OFFSET+3].comment, "Adjust image resolution");
strcpy(items[VI_OFFSET+4].comment, "Adjust artifacts caused by color changes");
strcpy(items[VI_OFFSET+5].comment, "Adjust color resolution reduction");
strcpy(items[VI_OFFSET+6].comment, "Adjust artifacts caused by brightness changes");
ntsc_offset = 5;
m->max_items = VI_OFFSET + 10 + (config.aspect == 0);
m->max_items = VI_OFFSET + 11 + (config.aspect == 0);
}
else
{
sprintf (items[VI_OFFSET].text, "NTSC Filter: OFF");
strcpy(items[VI_OFFSET+1].text, items[VI_OFFSET+5+1].text);
sprintf (items[VI_OFFSET+1].text, "NTSC Filter: OFF");
strcpy(items[VI_OFFSET+2].text, items[VI_OFFSET+5+2].text);
strcpy(items[VI_OFFSET+3].text, items[VI_OFFSET+5+3].text);
strcpy(items[VI_OFFSET+4].text, items[VI_OFFSET+5+4].text);
strcpy(items[VI_OFFSET+5].text, items[VI_OFFSET+5+5].text);
strcpy(items[VI_OFFSET+1].comment, items[VI_OFFSET+5+1].comment);
strcpy(items[VI_OFFSET+6].text, items[VI_OFFSET+5+6].text);
strcpy(items[VI_OFFSET+2].comment, items[VI_OFFSET+5+2].comment);
strcpy(items[VI_OFFSET+3].comment, items[VI_OFFSET+5+3].comment);
strcpy(items[VI_OFFSET+4].comment, items[VI_OFFSET+5+4].comment);
strcpy(items[VI_OFFSET+5].comment, items[VI_OFFSET+5+5].comment);
strcpy(items[VI_OFFSET+6].comment, items[VI_OFFSET+5+6].comment);
ntsc_offset = 0;
m->max_items = VI_OFFSET + 5 + (config.aspect == 0);
m->max_items = VI_OFFSET + 6 + (config.aspect == 0);
}
break;
}
case VI_OFFSET+1: /*** NTSC Sharpness ***/
case VI_OFFSET+2: /*** NTSC Sharpness ***/
GUI_OptionBox(m,update_bgm,"NTSC Sharpness",(void *)&config.ntsc_sharpness,0.01,-1.0,1.0,0);
sprintf(items[VI_OFFSET+1].text, "NTSC Sharpness: %1.2f", config.ntsc_sharpness);
sprintf(items[VI_OFFSET+2].text, "NTSC Sharpness: %1.2f", config.ntsc_sharpness);
break;
case VI_OFFSET+2: /*** NTSC Resolution ***/
case VI_OFFSET+3: /*** NTSC Resolution ***/
GUI_OptionBox(m,update_bgm,"NTSC Resolution",(void *)&config.ntsc_resolution,0.01,0.0,1.0,0);
sprintf(items[VI_OFFSET+2].text, "NTSC Resolution: %1.2f", config.ntsc_resolution);
sprintf(items[VI_OFFSET+3].text, "NTSC Resolution: %1.2f", config.ntsc_resolution);
break;
case VI_OFFSET+3: /*** NTSC Artifacts ***/
case VI_OFFSET+4: /*** NTSC Artifacts ***/
GUI_OptionBox(m,update_bgm,"NTSC Artifacts",(void *)&config.ntsc_artifacts,0.01,-1.0,0.0,0);
sprintf(items[VI_OFFSET+3].text, "NTSC Artifacts: %1.2f", config.ntsc_artifacts);
sprintf(items[VI_OFFSET+4].text, "NTSC Artifacts: %1.2f", config.ntsc_artifacts);
break;
case VI_OFFSET+4: /*** NTSC Color Bleed ***/
case VI_OFFSET+5: /*** NTSC Color Bleed ***/
GUI_OptionBox(m,update_bgm,"NTSC Color Bleed",(void *)&config.ntsc_bleed,0.01,-1.0,1.0,0);
sprintf(items[VI_OFFSET+4].text, "NTSC Color Bleed: %1.2f", config.ntsc_bleed);
sprintf(items[VI_OFFSET+5].text, "NTSC Color Bleed: %1.2f", config.ntsc_bleed);
break;
case VI_OFFSET+5: /*** NTSC Color Fringing ***/
case VI_OFFSET+6: /*** NTSC Color Fringing ***/
GUI_OptionBox(m,update_bgm,"NTSC Color Fringing",(void *)&config.ntsc_fringing,0.01,-1.0,1.0,0);
sprintf(items[VI_OFFSET+5].text, "NTSC Color Fringing: %1.2f", config.ntsc_fringing);
sprintf(items[VI_OFFSET+6].text, "NTSC Color Fringing: %1.2f", config.ntsc_fringing);
break;
case VI_OFFSET+6: /*** overscan emulation ***/
case VI_OFFSET+7: /*** overscan emulation ***/
{
config.overscan = (config.overscan + 1) & 3;
if (config.overscan == 3)
sprintf (items[VI_OFFSET+ntsc_offset+1].text, "Borders: FULL");
sprintf (items[VI_OFFSET+ntsc_offset+2].text, "Borders: FULL");
else if (config.overscan == 2)
sprintf (items[VI_OFFSET+ntsc_offset+1].text, "Borders: H ONLY");
sprintf (items[VI_OFFSET+ntsc_offset+2].text, "Borders: H ONLY");
else if (config.overscan == 1)
sprintf (items[VI_OFFSET+ntsc_offset+1].text, "Borders: V ONLY");
sprintf (items[VI_OFFSET+ntsc_offset+2].text, "Borders: V ONLY");
else
sprintf (items[VI_OFFSET+ntsc_offset+1].text, "Borders: NONE");
sprintf (items[VI_OFFSET+ntsc_offset+2].text, "Borders: NONE");
break;
}
case VI_OFFSET+7: /*** Game Gear extended screen */
case VI_OFFSET+8: /*** Game Gear extended screen */
{
config.gg_extra ^= 1;
sprintf(items[VI_OFFSET+ntsc_offset+2].text, "GG Screen: %s", config.gg_extra ? "EXTENDED":"ORIGINAL");
sprintf(items[VI_OFFSET+ntsc_offset+3].text, "GG Screen: %s", config.gg_extra ? "EXTENDED":"ORIGINAL");
break;
}
case VI_OFFSET+8: /*** aspect ratio ***/
case VI_OFFSET+9: /*** aspect ratio ***/
{
config.aspect = (config.aspect + 1) % 3;
if (config.aspect == 1)
sprintf (items[VI_OFFSET+ntsc_offset+3].text,"Aspect: ORIGINAL (4:3)");
sprintf (items[VI_OFFSET+ntsc_offset+4].text,"Aspect: ORIGINAL (4:3)");
else if (config.aspect == 2)
sprintf (items[VI_OFFSET+ntsc_offset+3].text, "Aspect: ORIGINAL (16:9)");
sprintf (items[VI_OFFSET+ntsc_offset+4].text, "Aspect: ORIGINAL (16:9)");
else
sprintf (items[VI_OFFSET+ntsc_offset+3].text, "Aspect: SCALED");
sprintf (items[VI_OFFSET+ntsc_offset+4].text, "Aspect: SCALED");
if (config.aspect)
{
/* disable items */
m->max_items = VI_OFFSET + ntsc_offset + 5;
m->max_items = VI_OFFSET + ntsc_offset + 6;
/* reset menu selection */
if (m->selected < 2)
{
m->offset = VI_OFFSET + ntsc_offset + 1;
m->offset = VI_OFFSET + ntsc_offset + 2;
m->selected = 2;
}
}
else
{
/* enable items */
m->max_items = VI_OFFSET + ntsc_offset + 6;
m->max_items = VI_OFFSET + ntsc_offset + 7;
}
break;
}
case VI_OFFSET+9: /*** screen position ***/
case VI_OFFSET+10: /*** screen position ***/
{
if (system_hw)
{
state[0] = m->arrows[0]->state;
@ -2000,7 +2054,7 @@ static void videomenu ()
m->arrows[1]->state = state[1];
m->screenshot = 0;
strcpy(m->title,"Video Settings");
sprintf (items[VI_OFFSET+ntsc_offset+4].text, "Screen Position: (%s%02d,%s%02d)",
sprintf (items[VI_OFFSET+ntsc_offset+5].text, "Screen Position: (%s%02d,%s%02d)",
(config.xshift < 0) ? "":"+", config.xshift,
(config.yshift < 0) ? "":"+", config.yshift);
}
@ -2009,8 +2063,10 @@ static void videomenu ()
GUI_WaitPrompt("Error","Please load a game first !\n");
}
break;
}
case VI_OFFSET+10: /*** screen scaling ***/
case VI_OFFSET+11: /*** screen scaling ***/
{
if (system_hw)
{
state[0] = m->arrows[0]->state;
@ -2028,7 +2084,7 @@ static void videomenu ()
m->arrows[1]->state = state[1];
m->screenshot = 0;
strcpy(m->title,"Video Settings");
sprintf (items[VI_OFFSET+ntsc_offset+5].text, "Screen Scaling: (%s%02d,%s%02d)",
sprintf (items[VI_OFFSET+ntsc_offset+6].text, "Screen Scaling: (%s%02d,%s%02d)",
(config.xscale < 0) ? "":"+", config.xscale,
(config.yscale < 0) ? "":"+", config.yscale);
}
@ -2037,10 +2093,13 @@ static void videomenu ()
GUI_WaitPrompt("Error","Please load a game first !\n");
}
break;
}
case -1:
{
quit = 1;
break;
}
}
}
@ -3898,9 +3957,9 @@ void mainmenu(void)
/* Soft Reset */
gen_reset(0);
}
else if (system_hw == SYSTEM_SMS)
else if ((system_hw == SYSTEM_SMS) && (region_code != REGION_JAPAN_NTSC))
{
/* assert RESET input (Master System model 1 only) */
/* assert RESET input (export Master System 1 only) */
io_reg[0x0D] &= ~IO_RESET_HI;
}
else

View File

@ -2083,7 +2083,7 @@ void md_ntsc_blit( md_ntsc_t const* ntsc, MD_NTSC_IN_T const* table, unsigned ch
MD_NTSC_RGB_OUT( 7, *line_out++ );
line_out += 12;
}
}
/* finish final pixels */
MD_NTSC_COLOR_IN( 0, ntsc, MD_NTSC_ADJ_IN( table[*input++] ) );

View File

@ -52,17 +52,34 @@
/* One tile is 32 byte = 4x4 pixels */
/* Tiles are stored continuously in texture memory */
#define CUSTOM_BLITTER(line, width, table, in) \
{ \
width >>= 2; \
u16 *out = (u16 *) (bitmap.data + (((width << 5) * (line >> 2)) + ((line & 3) << 3))); \
do \
{ \
*out++ = table[*in++]; \
*out++ = table[*in++]; \
*out++ = table[*in++]; \
*out++ = table[*in++]; \
out += 12; \
} \
while (--width);
if (config.lcd) \
{ \
do \
{ \
RENDER_PIXEL_LCD(in,out,table,config.lcd); \
RENDER_PIXEL_LCD(in,out,table,config.lcd); \
RENDER_PIXEL_LCD(in,out,table,config.lcd); \
RENDER_PIXEL_LCD(in,out,table,config.lcd); \
out += 12; \
} \
while (--width); \
} \
else \
{ \
do \
{ \
*out++ = table[*in++]; \
*out++ = table[*in++]; \
*out++ = table[*in++]; \
*out++ = table[*in++]; \
out += 12; \
} \
while (--width); \
} \
}
/* image texture */
typedef struct

View File

@ -5,23 +5,18 @@
*
* Copyright (C) 2009 Eke-Eke, with some code from libogc (C) Hector Martin
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* - Redistributions must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

View File

@ -5,23 +5,18 @@
*
* Copyright (C) 2009 Eke-Eke, with some code from libogc (C) Hector Martin
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* - Redistributions may not be sold, nor may they be used in a commercial
* product or activity.
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* - Redistributions that are modified from the original source must include the
* complete source code, including the source code for all components used by a
* binary built from the modified sources. However, as a special exception, the
* source code distributed need not include anything that is normally distributed
* (in either source or binary form) with the major components (compiler, kernel,
* and so on) of the operating system on which the executable runs, unless that
* component itself accompanies the executable.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* - Redistributions must reproduce the above copyright notice, this list of
* conditions and the following disclaimer in the documentation and/or other
* materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE

View File

@ -33,6 +33,8 @@ void set_config_defaults(void)
config.addr_error = 1;
config.bios = 0;
config.lock_on = 0; /* = OFF (can be TYPE_SK, TYPE_GG & TYPE_AR) */
config.ntsc = 0;
config.lcd = 0; /* 0.8 fixed point */
/* display options */
config.overscan = 0; /* 3 = all borders (0 = no borders , 1 = vertical borders only, 2 = horizontal borders only) */

View File

@ -41,6 +41,7 @@ typedef struct
uint8 overscan;
uint8 gg_extra;
uint8 ntsc;
uint8 lcd;
uint8 render;
t_input_config input[MAX_INPUTS];
} t_config;