Unverified Commit d915fdaa authored by twinaphex's avatar twinaphex Committed by GitHub
Browse files

Merge pull request #158 from kps501/temp

Backport features, Add libretro features
parents 7edb0386 08bb6ade
......@@ -1207,11 +1207,12 @@ void S9xSetC4 (uint8 byte, uint16 Address)
if (Memory.C4RAM[0x1f4d] != 0x0e)
printf("$7f4d=%02x, expected 0e for command 54 %02x\n", Memory.C4RAM[0x1f4d], Memory.C4RAM[0x1f4d]);
#endif
int64 b = (int64) READ_3WORD(Memory.C4RAM + 0x1f80);
int64 c = b << 40;
int64 a = SAR(c, 30);
// libretro: msvc2005 hack
int64 b = (int64) READ_3WORD(Memory.C4RAM + 0x1f80);
int64 c = b << 40;
int64 a = SAR(c, 30);
//printf("%08X%08X\n", (uint32) (a>>32), (uint32) (a&0xFFFFFFFF));
a = SAR(c, 10);
a = SAR(c, 10);
a *= a;
//printf("%08X%08X\n", (uint32) (a>>32), (uint32) (a&0xFFFFFFFF));
WRITE_3WORD(Memory.C4RAM + 0x1f83, a);
......
......@@ -214,7 +214,7 @@ void S9xInitSuperFX (void)
void S9xResetSuperFX (void)
{
// FIXME: Snes9x can't execute CPU and SuperFX at a time. Don't ask me what is 0.417 :P
SuperFX.speedPerLine = (uint32) (Settings.SuperFXSpeedPerLine * ((1.0f / Memory.ROMFramesPerSecond) / ((float) (Timings.V_Max))));
SuperFX.speedPerLine = (uint32) (0.417 * 10.5e6 * ((1.0 / (float) Memory.ROMFramesPerSecond) / ((float) (Timings.V_Max))));
SuperFX.oneLineDone = FALSE;
SuperFX.vFlags = 0;
CPU.IRQExternal = FALSE;
......@@ -315,7 +315,7 @@ uint8 S9xGetSuperFX (uint16 address)
uint8 byte;
byte = Memory.FillRAM[address];
if (address == 0x3031)
{
CPU.IRQExternal = FALSE;
......@@ -329,7 +329,7 @@ void S9xSuperFXExec (void)
{
if ((Memory.FillRAM[0x3000 + GSU_SFR] & FLG_G) && (Memory.FillRAM[0x3000 + GSU_SCMR] & 0x18) == 0x18)
{
FxEmulate((Memory.FillRAM[0x3000 + GSU_CLSR] & 1) ? SuperFX.speedPerLine * 2 : SuperFX.speedPerLine);
FxEmulate(((Memory.FillRAM[0x3000 + GSU_CLSR] & 1) ? SuperFX.speedPerLine * 2 : SuperFX.speedPerLine) * Settings.SuperFXClockMultiplier / 100);
uint16 GSUStatus = Memory.FillRAM[0x3000 + GSU_SFR] | (Memory.FillRAM[0x3000 + GSU_SFR + 1] << 8);
if ((GSUStatus & (FLG_G | FLG_IRQ)) == FLG_IRQ)
......
This diff is collapsed.
......@@ -1274,14 +1274,6 @@ static bool8 is_GNEXT_Add_On (const uint8 *data, uint32 size)
return (FALSE);
}
static bool8 MsuRomExists (void)
{
struct stat buf;
const char *path = S9xGetFilename(".msu", ROMFILENAME_DIR);
return (stat(path, &buf) == 0);
}
int CMemory::ScoreHiROM (bool8 skip_header, int32 romoff)
{
uint8 *buf = ROM + 0xff00 + romoff + (skip_header ? 0x200 : 0);
......@@ -2043,13 +2035,12 @@ bool8 CMemory::LoadGNEXT ()
bool8 CMemory::LoadSRTC (void)
{
FILE *fp;
size_t ignore;
fp = fopen(S9xGetFilename(".rtc", SRAM_DIR), "rb");
if (!fp)
return (FALSE);
ignore = fread(RTCData.reg, 1, 20, fp);
fread(RTCData.reg, 1, 20, fp);
fclose(fp);
return (TRUE);
......@@ -2058,13 +2049,12 @@ bool8 CMemory::LoadSRTC (void)
bool8 CMemory::SaveSRTC (void)
{
FILE *fp;
size_t ignore;
fp = fopen(S9xGetFilename(".rtc", SRAM_DIR), "wb");
if (!fp)
return (FALSE);
ignore = fwrite(RTCData.reg, 1, 20, fp);
fwrite(RTCData.reg, 1, 20, fp);
fclose(fp);
return (TRUE);
......@@ -2191,8 +2181,7 @@ bool8 CMemory::SaveSRAM (const char *filename)
file = fopen(name, "wb");
if (file)
{
size_t ignore;
ignore = fwrite((char *) Multi.sramB, size, 1, file);
fwrite((char *) Multi.sramB, size, 1, file);
fclose(file);
}
......@@ -2208,8 +2197,7 @@ bool8 CMemory::SaveSRAM (const char *filename)
file = fopen(sramName, "wb");
if (file)
{
size_t ignore;
ignore = fwrite((char *) SRAM, size, 1, file);
fwrite((char *) SRAM, size, 1, file);
fclose(file);
if (Settings.SRTC || Settings.SPC7110RTC)
......@@ -2800,7 +2788,7 @@ void CMemory::map_lorom (uint32 bank_s, uint32 bank_e, uint32 addr_s, uint32 add
if (auto_export_map)
{
struct retro_memory_descriptor desc = {0};
struct retro_memory_descriptor desc = {};
desc.flags=RETRO_MEMDESC_CONST;
desc.ptr=ROM;
desc.start=bank_s<<16 | addr_s;
......@@ -2829,7 +2817,7 @@ void CMemory::map_hirom (uint32 bank_s, uint32 bank_e, uint32 addr_s, uint32 add
if (auto_export_map)
{
struct retro_memory_descriptor desc = {0};
struct retro_memory_descriptor desc = {};
desc.flags=RETRO_MEMDESC_CONST;
desc.ptr=ROM;
desc.offset=map_mirror(size, addr_s);
......@@ -2858,7 +2846,7 @@ void CMemory::map_lorom_offset (uint32 bank_s, uint32 bank_e, uint32 addr_s, uin
if (auto_export_map)
{
struct retro_memory_descriptor desc = {0};
struct retro_memory_descriptor desc = {};
desc.flags=RETRO_MEMDESC_CONST;
desc.ptr=ROM;
desc.offset=offset;
......@@ -2888,7 +2876,7 @@ void CMemory::map_hirom_offset (uint32 bank_s, uint32 bank_e, uint32 addr_s, uin
if (auto_export_map)
{
struct retro_memory_descriptor desc = {0};
struct retro_memory_descriptor desc = {};
desc.flags=RETRO_MEMDESC_CONST;
desc.ptr=ROM;
desc.offset=map_mirror(size, offset + addr_s);
......@@ -2915,7 +2903,7 @@ void CMemory::map_space (uint32 bank_s, uint32 bank_e, uint32 addr_s, uint32 add
}
if (auto_export_map)
{
struct retro_memory_descriptor desc = {0};
struct retro_memory_descriptor desc = {};
desc.ptr=data;
desc.start=bank_s<<16 | addr_s;
desc.select=(bank_s<<16 | addr_s) ^ (bank_e<<16 | addr_e) ^ 0xFFFFFF;
......@@ -2945,7 +2933,7 @@ void CMemory::map_index (uint32 bank_s, uint32 bank_e, uint32 addr_s, uint32 add
if (auto_export_map)
{
struct retro_memory_descriptor desc = {0};
struct retro_memory_descriptor desc = {};
desc.start=bank_s<<16 | addr_s;
desc.select=(bank_s<<16 | addr_s) ^ (bank_e<<16 | addr_e) ^ 0xFFFFFF;
if (type==MAP_LOROM_SRAM || type==MAP_SA1RAM)
......
......@@ -1404,8 +1404,11 @@ void S9xFreezeToStream (STREAM stream)
if (Settings.BS)
FreezeStruct(stream, "BSX", &BSX, SnapBSX, COUNT(SnapBSX));
// libretro: g++ guard warning
if (Settings.MSU1)
{
FreezeStruct(stream, "MSU", &MSU1, SnapMSU1, COUNT(SnapMSU1));
}
delete [] soundsnapshot;
}
......@@ -2055,7 +2058,6 @@ static bool CheckBlockName(STREAM stream, const char *name, int &len)
{
char buffer[16];
len = 0;
long rewind = FIND_STREAM(stream);
size_t l = READ_STREAM(buffer, 11, stream);
buffer[l] = 0;
......
......@@ -211,13 +211,13 @@ extern FILE *trace;
#define S9X_CONF_FILE_NAME "snes9x.conf"
#ifndef __LIBRETRO__
static char *rom_filename = NULL;
static bool parse_controller_spec (int, const char *);
static void parse_crosshair_spec (enum crosscontrols, const char *);
static bool try_load_config_file (const char *, ConfigFile &);
#ifndef __LIBRETRO__
static bool parse_controller_spec (int port, const char *arg)
{
if (!strcasecmp(arg, "none"))
......
......@@ -377,7 +377,7 @@ struct SSettings
bool8 TraceDSP;
bool8 TraceHCEvent;
bool8 TraceSMP;
bool8 SuperFX;
uint8 DSP;
bool8 SA1;
......@@ -423,7 +423,6 @@ struct SSettings
bool8 SupportHiRes;
bool8 Transparency;
float SuperFXSpeedPerLine;
uint8 BG_Forced;
bool8 DisableGraphicWindows;
......@@ -465,6 +464,7 @@ struct SSettings
bool8 UpAndDown;
bool8 OpenGLEnable;
uint32 SuperFXClockMultiplier;
bool8 FastSavestates;
bool8 HardDisableAudio;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment