diff --git a/apu/apu.cpp b/apu/apu.cpp index 65df1b59..604478d6 100644 --- a/apu/apu.cpp +++ b/apu/apu.cpp @@ -464,8 +464,7 @@ bool8 S9xInitSound (int buffer_ms, int lag_ms) void S9xSetSoundControl (uint8 voice_switch) { - /* - spc_core->dsp_set_stereo_switch(voice_switch << 8 | voice_switch); */ + SNES::dsp.spc_dsp.set_stereo_switch (voice_switch << 8 | voice_switch); } void S9xSetSoundMute (bool8 mute) @@ -477,7 +476,7 @@ void S9xSetSoundMute (bool8 mute) void S9xDumpSPCSnapshot (void) { -/* No SPC dumping ATM in byuu SMP */ +/* TODO: SPC dumping */ /* spc_core->dsp_dump_spc_snapshot(); */ } @@ -578,14 +577,6 @@ void S9xAPUTimingSetSpeedup (int ticks) UpdatePlaybackRate(); } -void S9xAPUAllowTimeOverflow (bool allow) -{ - if (allow) - printf("APU time overflow allowed\n"); - - /* spc_core->spc_allow_time_overflow(allow); */ -} - void S9xResetAPU (void) { spc::reference_time = 0; @@ -614,6 +605,7 @@ void S9xSoftResetAPU (void) void S9xAPUSaveState (uint8 *block) { +// TODO: Save states /* uint8 *ptr = block; spc_core->copy_state(&ptr, from_apu_to_state); @@ -625,7 +617,7 @@ void S9xAPUSaveState (uint8 *block) void S9xAPULoadState (uint8 *block) { - /*uint8 *ptr = block; +/* uint8 *ptr = block; S9xResetAPU(); diff --git a/apu/bapu/smp/core.cpp b/apu/bapu/smp/core.cpp index eb03b46e..01f265a5 100755 --- a/apu/bapu/smp/core.cpp +++ b/apu/bapu/smp/core.cpp @@ -3,7 +3,7 @@ void SMP::tick() { timer1.tick(); timer2.tick(); -#ifdef BSNES +#ifndef SNES9X clock += cycle_step_cpu; #else clock++; @@ -75,7 +75,7 @@ void SMP::op_step() { timer1.tick(cycle_count_table[opcode]); timer2.tick(cycle_count_table[opcode]); -#ifdef BSNES +#ifndef SNES9X clock += cycle_table_cpu[opcode]; #else clock += cycle_count_table[opcode]; diff --git a/apu/bapu/smp/smp.cpp b/apu/bapu/smp/smp.cpp index 7a1b2e25..49556f3f 100755 --- a/apu/bapu/smp/smp.cpp +++ b/apu/bapu/smp/smp.cpp @@ -1,4 +1,8 @@ +#ifndef SNES9X #define CYCLE_ACCURATE +#else +#undef CYCLE_ACCURATE +#endif #include @@ -20,7 +24,7 @@ namespace SNES { #include "timing.cpp" void SMP::synchronize_cpu() { -#ifdef BSNES +#ifndef SNES9X if(CPU::Threaded == true) { //if(clock >= 0 && scheduler.sync != Scheduler::SynchronizeMode::All) co_switch(cpu.thread); } else { @@ -42,7 +46,7 @@ void SMP::enter() { } void SMP::power() { -#ifdef BSNES +#ifndef SNES9X Processor::frequency = system.apu_frequency(); #endif @@ -92,7 +96,7 @@ void SMP::reset() { timer0.stage3_ticks = timer1.stage3_ticks = timer2.stage3_ticks = 0; } -#ifdef BSNES +#ifndef SNES9X void SMP::serialize(serializer &s) { Processor::serialize(s); diff --git a/apu/bapu/smp/smp.hpp b/apu/bapu/smp/smp.hpp index be52f77a..5d2c3d64 100755 --- a/apu/bapu/smp/smp.hpp +++ b/apu/bapu/smp/smp.hpp @@ -17,7 +17,7 @@ public: void power(); void reset(); -#ifdef BSNES +#ifndef SNES9X void serialize(serializer&); #endif SMP(); @@ -35,7 +35,7 @@ public: alwaysinline unsigned operator=(unsigned data) { n = data & 0x80; v = data & 0x40; p = data & 0x20; b = data & 0x10; h = data & 0x08; i = data & 0x04; z = data & 0x02; c = data & 0x01; - return *this; + return data; } alwaysinline unsigned operator|=(unsigned data) { return operator=(operator unsigned() | data); } diff --git a/apu/bapu/snes/snes.hpp b/apu/bapu/snes/snes.hpp index 30845973..be7e73f1 100755 --- a/apu/bapu/snes/snes.hpp +++ b/apu/bapu/snes/snes.hpp @@ -1,11 +1,21 @@ #ifndef __SNES_HPP #define __SNES_HPP -#define CYCLE_ACCURATE - #include "snes9x.h" -#define alwaysinline inline +#define SNES9X + +#if defined(__GNUC__) + #define inline inline + #define alwaysinline inline __attribute__((always_inline)) +#elif defined(_MSC_VER) + #define inline inline + #define alwaysinline inline __forceinline +#else + #define inline inline + #define alwaysinline inline +#endif + #define debugvirtual namespace SNES @@ -27,22 +37,17 @@ public: int frequency; uint8 registers[4]; - inline void enter () - { - return; - } - inline void reset () { registers[0] = registers[1] = registers[2] = registers[3] = 0; } - inline void port_write (uint8 port, uint8 data) + alwaysinline void port_write (uint8 port, uint8 data) { registers[port & 3] = data; } - inline uint8 port_read (uint8 port) + alwaysinline uint8 port_read (uint8 port) { // printf ("APU Read %2x from port %d\n", registers[port & 3], port & 3); return registers[port & 3]; diff --git a/memmap.cpp b/memmap.cpp index 81edf082..7bf9bf6e 100644 --- a/memmap.cpp +++ b/memmap.cpp @@ -1502,7 +1502,7 @@ bool8 CMemory::LoadROM (const char *filename) ZeroMemory(ROM, MAX_ROM_SIZE); ZeroMemory(&Multi, sizeof(Multi)); - + again: Settings.DisplayColor = BUILD_PIXEL(31, 31, 31); SET_UI_COLOR(255, 255, 255); @@ -2254,7 +2254,7 @@ void CMemory::InitROM (void) Settings.SETA = 0; Settings.SRTC = FALSE; Settings.BS = FALSE; - + SuperFX.nRomBanks = CalculatedSize >> 15; //// Parse ROM header and read ROM informatoin @@ -3204,7 +3204,7 @@ void CMemory::Map_SPC7110HiROMMap (void) map_System(); map_index(0x00, 0x00, 0x6000, 0x7fff, MAP_HIROM_SRAM, MAP_TYPE_RAM); - map_hirom(0x00, 0x0f, 0x8000, 0xffff, CalculatedSize); + map_hirom(0x00, 0x0f, 0x8000, 0xffff, CalculatedSize); map_index(0x30, 0x30, 0x6000, 0x7fff, MAP_HIROM_SRAM, MAP_TYPE_RAM); map_index(0x50, 0x50, 0x0000, 0xffff, MAP_SPC7110_DRAM, MAP_TYPE_ROM); map_hirom(0x80, 0x8f, 0x8000, 0xffff, CalculatedSize); @@ -3499,14 +3499,13 @@ void CMemory::ApplyROMFixes (void) //// APU timing hacks :( Timings.APUSpeedup = 0; - Timings.APUAllowTimeOverflow = FALSE; if (!Settings.DisableGameSpecificHacks) { if (match_id("AVCJ")) // Rendering Ranger R2 - Timings.APUSpeedup = 4; + Timings.APUSpeedup = 2; - if (match_na("GAIA GENSOUKI 1 JPN") || // Gaia Gensouki +/* if (match_na("GAIA GENSOUKI 1 JPN") || // Gaia Gensouki match_id("JG ") || // Illusion of Gaia match_id("CQ ") || // Stunt Race FX match_na("SOULBLADER - 1") || // Soul Blader @@ -3540,22 +3539,10 @@ void CMemory::ApplyROMFixes (void) match_nn("Parlor") || // Parlor mini/2/3/4/5/6/7, Parlor Parlor!/2/3/4/5 match_na("HEIWA Parlor!Mini8") || // Parlor mini 8 match_nn("SANKYO Fever! \xCC\xA8\xB0\xCA\xDE\xB0!")) // SANKYO Fever! Fever! - Timings.APUSpeedup = 1; - - if (match_na ("EARTHWORM JIM 2") || // Earthworm Jim 2 - match_na ("NBA Hangtime") || // NBA Hang Time - match_na ("MSPACMAN") || // Ms Pacman - match_na ("THE MASK") || // The Mask - match_na ("PRIMAL RAGE") || // Primal Rage - match_na ("PORKY PIGS HAUNTED") || // Porky Pig's Haunted Holiday - match_na ("Big Sky Trooper") || // Big Sky Trooper - match_id ("A35") || // Mechwarrior 3050 / Battle Tech 3050 - match_na ("DOOM TROOPERS")) // Doom Troopers - Timings.APUAllowTimeOverflow = TRUE; + Timings.APUSpeedup = 1; */ } S9xAPUTimingSetSpeedup(Timings.APUSpeedup); - S9xAPUAllowTimeOverflow(Timings.APUAllowTimeOverflow); //// Other timing hacks :( diff --git a/snapshot.cpp b/snapshot.cpp index e2163de6..55823b4e 100644 --- a/snapshot.cpp +++ b/snapshot.cpp @@ -2278,7 +2278,7 @@ static void UnfreezeStructFromCopy (void *sbase, FreezeData *fields, int num_fie bool8 S9xSPCDump (const char *filename) { - /* No SPC dumping in byuu SMP */ + /* TODO: No SPC dumping in byuu SMP */ /* FILE *fs; uint8 buf[SNES_SPC::spc_file_size];