Merge pull request #222 from retro-wertz/libretro

Libretro
This commit is contained in:
Twinaphex
2018-06-15 06:53:06 +02:00
committed by GitHub
6 changed files with 28 additions and 23 deletions

View File

@@ -210,6 +210,8 @@ static void UNROM512HSync(void) {
}
void UNROM512_Init(CartInfo *info) {
int mirror;
memset(fceumm_flash_buf, 0x00, fceumm_flash_buf_size);
flash_state = 0;
flash_bank = 0;
@@ -222,7 +224,21 @@ void UNROM512_Init(CartInfo *info) {
else
chrram_mask = 0x60;
SetupCartMirroring(info->mirror, (info->mirror >= MI_0) ? 0 : 1, 0);
mirror = (head.ROM_type & 1) | ((head.ROM_type & 8) >> 2);
switch (mirror) {
case 0: // hard horizontal, internal
SetupCartMirroring(MI_H, 1, NULL);
break;
case 1: // hard vertical, internal
SetupCartMirroring(MI_V, 1, NULL);
break;
case 2: // switchable 1-screen, internal (flags: 4-screen + horizontal)
SetupCartMirroring(MI_0, 0, NULL);
break;
case 3: // hard four screen, last 8k of 32k RAM (flags: 4-screen + vertical)
SetupCartMirroring(4, 1, VROM + (info->vram_size - 8192));
break;
}
bus_conflict = !info->battery;
latcheinit = 0;
WLSync = UNROM512LSync;

View File

@@ -218,10 +218,8 @@ FILE *FCEUD_UTF8fopen(const char *n, const char *m)
/*palette for FCEU*/
#define MAXPAL 17 /* raw palette # */
static int use_ntsc = 0;
static int external_palette_exist = 0;
extern int ipalette;
extern int ntsccol;
struct st_palettes {
char name[32];
@@ -584,7 +582,6 @@ void retro_set_environment(retro_environment_t cb)
{ "fceumm_aspect", "Preferred aspect ratio; 8:7 PAR|4:3" },
{ "fceumm_palette", "Color Palette; default|asqrealc|nintendo-vc|rgb|yuv-v3|unsaturated-final|sony-cxa2025as-us|pal|bmf-final2|bmf-final3|smooth-fbx|composite-direct-fbx|pvm-style-d93-fbx|ntsc-hardware-fbx|nes-classic-fbx-fs|nescap|wavebeam|raw|custom" },
{ "fceumm_up_down_allowed", "Allow Opposing Directions; disabled|enabled" },
{ "fceumm_use_ntsc", "Use NTSC Palette; disabled|enabled" },
#ifdef PSP
{ "fceumm_overscan", "Crop Overscan; enabled|disabled" },
#else
@@ -691,21 +688,18 @@ static void retro_set_custom_palette(void)
uint8_t i,r,g,b;
ipalette = 0;
ntsccol = 0;
use_raw_palette = false;
if (current_palette == 0 || current_palette > MAXPAL
|| (GameInfo->type == GIT_VSUNI))
if (!current_palette || current_palette > MAXPAL || (GameInfo->type == GIT_VSUNI))
{
if (current_palette > MAXPAL && GameInfo->type != GIT_VSUNI)
{
if (external_palette_exist)
{
ipalette = 1;
}
}
if (current_palette == 0)
ntsccol = use_ntsc;
FCEU_ResetPalette(); /* Do palette reset. Priority will be:
* -ipalette : sets external palette
* -ntsccol : sets ntsc to default palette.
@@ -946,14 +940,6 @@ static void check_variables(bool startup)
else
up_down_allowed = false;
var.key = "fceumm_use_ntsc";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
{
use_ntsc = (!strcmp(var.value, "enabled")) ? 1 : 0;
retro_set_custom_palette();
}
var.key = "fceumm_nospritelimit";
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)

View File

@@ -277,6 +277,7 @@
{0x4f2f1846, 206, 1}, /* Famista '89 - Kaimaku Han!! (J) */
{0x22d6d5bd, 206, 1}, /* Jikuu Yuuden - Debias (J) */
{0x9d21fe96, 206, 1}, /* Lupin Sansei - Pandora no Isan (Japan) */
{0xae321339, 206, 1}, /* Pro Yakyuu - Family Stadium '88 (Japan) */
{0x96dfc776, 206, 1}, /* R.B.I. Baseball 2 (USA) (Unl) */
{0xfd63e7ac, 206, 1}, /* R.B.I. Baseball 3 (USA) (Unl) */
{0x2a01f9d1, 206, 1}, /* Wagyan Land (Japan) */

View File

@@ -22,9 +22,6 @@
#ifndef _FCEU_INES_H
#define _FCEU_INES_H
extern uint32 ROM_size;
extern uint32 VROM_size;
typedef struct {
char ID[4]; /*NES^Z*/
uint8 ROM_size;
@@ -34,6 +31,12 @@ typedef struct {
uint8 reserve[8];
} iNES_HEADER;
extern uint8 *ROM;
extern uint8 *VROM;
extern uint32 ROM_size;
extern uint32 VROM_size;
extern iNES_HEADER head;
void NSFVRC6_Init(void);
void NSFMMC5_Init(void);
void NSFAY_Init(void);

View File

@@ -34,7 +34,7 @@
#define M_PI 3.14159265358979323846
#endif
int ntsccol = 0;
static int ntsccol = 0;
static int ntsctint = 46 + 10;
static int ntschue = 72;

View File

@@ -6,7 +6,6 @@ typedef struct {
} pal;
extern pal *palo;
extern int ntsccol;
extern int ipalette;
void FCEU_ResetPalette(void);