mirror of
https://github.com/libretro/bsnes-libretro-cplusplus98.git
synced 2025-04-09 05:40:39 +00:00
Revert "Use snes_interface for global symbol."
This reverts commit 7d07cb17516c3ce1269c0af8d80431da6f3139a0.
This commit is contained in:
parent
5e45aa7d57
commit
b927f5f9db
@ -20,7 +20,7 @@ void Audio::coprocessor_frequency(double input_frequency) {
|
||||
}
|
||||
|
||||
void Audio::sample(int16 lsample, int16 rsample) {
|
||||
if(coprocessor == false) return snes_interface->audioSample(lsample, rsample);
|
||||
if(coprocessor == false) return interface->audioSample(lsample, rsample);
|
||||
|
||||
dsp_buffer[dsp_wroffset] = ((uint16)lsample << 0) + ((uint16)rsample << 16);
|
||||
dsp_wroffset = (dsp_wroffset + 1) & buffer_mask;
|
||||
@ -73,7 +73,7 @@ void Audio::flush() {
|
||||
signed cop_left = (int16)(cop_sample >> 0);
|
||||
signed cop_right = (int16)(cop_sample >> 16);
|
||||
|
||||
snes_interface->audioSample(
|
||||
interface->audioSample(
|
||||
sclamp<16>((dsp_left + cop_left ) / 2),
|
||||
sclamp<16>((dsp_right + cop_right) / 2)
|
||||
);
|
||||
|
@ -229,16 +229,16 @@ void Cartridge::parse_markup_necdsp(BML::Node &root) {
|
||||
string firmware = root["firmware"].value;
|
||||
string sha256 = root["sha256"].value;
|
||||
|
||||
string path( dir(snes_interface->path(Slot::Base, ".dsp")), firmware );
|
||||
string path( dir(interface->path(Slot::Base, ".dsp")), firmware );
|
||||
unsigned promsize = (necdsp.revision.i == NECDSP::Revision::uPD7725 ? 2048 : 16384);
|
||||
unsigned dromsize = (necdsp.revision.i == NECDSP::Revision::uPD7725 ? 1024 : 2048);
|
||||
unsigned filesize = promsize * 3 + dromsize * 2;
|
||||
|
||||
file fp;
|
||||
if(fp.open(path, file::mode_read) == false) {
|
||||
snes_interface->message(string( "Warning: NEC DSP firmware ", firmware, " is missing." ));
|
||||
interface->message(string( "Warning: NEC DSP firmware ", firmware, " is missing." ));
|
||||
} else if(fp.size() != filesize) {
|
||||
snes_interface->message(string( "Warning: NEC DSP firmware ", firmware, " is of the wrong file size." ));
|
||||
interface->message(string( "Warning: NEC DSP firmware ", firmware, " is of the wrong file size." ));
|
||||
fp.close();
|
||||
} else {
|
||||
for(unsigned n = 0; n < promsize; n++) necdsp.programROM[n] = fp.readm(3);
|
||||
@ -251,7 +251,7 @@ void Cartridge::parse_markup_necdsp(BML::Node &root) {
|
||||
fp.read(data, filesize);
|
||||
|
||||
if(sha256 != nall::sha256(data, filesize)) {
|
||||
snes_interface->message(string( "Warning: NEC DSP firmware ", firmware, " SHA256 sum is incorrect." ));
|
||||
interface->message(string( "Warning: NEC DSP firmware ", firmware, " SHA256 sum is incorrect." ));
|
||||
}
|
||||
}
|
||||
|
||||
@ -294,12 +294,12 @@ void Cartridge::parse_markup_hitachidsp(BML::Node &root) {
|
||||
string firmware = root["firmware"].value;
|
||||
string sha256 = root["sha256"].value;
|
||||
|
||||
string path( dir(snes_interface->path(Slot::Base, ".dsp")), firmware );
|
||||
string path( dir(interface->path(Slot::Base, ".dsp")), firmware );
|
||||
file fp;
|
||||
if(fp.open(path, file::mode_read) == false) {
|
||||
snes_interface->message(string( "Warning: Hitachi DSP firmware ", firmware, " is missing." ));
|
||||
interface->message(string( "Warning: Hitachi DSP firmware ", firmware, " is missing." ));
|
||||
} else if(fp.size() != 1024 * 3) {
|
||||
snes_interface->message(string( "Warning: Hitachi DSP firmware ", firmware, " is of the wrong file size." ));
|
||||
interface->message(string( "Warning: Hitachi DSP firmware ", firmware, " is of the wrong file size." ));
|
||||
fp.close();
|
||||
} else {
|
||||
for(unsigned n = 0; n < 1024; n++) hitachidsp.dataROM[n] = fp.readl(3);
|
||||
@ -311,7 +311,7 @@ void Cartridge::parse_markup_hitachidsp(BML::Node &root) {
|
||||
fp.read(data, 3072);
|
||||
|
||||
if(sha256 != nall::sha256(data, 3072)) {
|
||||
snes_interface->message(string( "Warning: Hitachi DSP firmware ", firmware, " SHA256 sum is incorrect." ));
|
||||
interface->message(string( "Warning: Hitachi DSP firmware ", firmware, " SHA256 sum is incorrect." ));
|
||||
}
|
||||
}
|
||||
|
||||
@ -502,7 +502,7 @@ void Cartridge::parse_markup_setarisc(BML::Node &root) {
|
||||
|
||||
void Cartridge::parse_markup_msu1(BML::Node &root) {
|
||||
if(root.exists() == false) {
|
||||
has_msu1 = file::exists(snes_interface->path(Cartridge::Slot::Base, ".msu"));
|
||||
has_msu1 = file::exists(interface->path(Cartridge::Slot::Base, ".msu"));
|
||||
if(has_msu1) {
|
||||
Mapping m(READER( &MSU1::mmio_read, &msu1 ), WRITER( &MSU1::mmio_write, &msu1 ));
|
||||
m.banklo = 0x00, m.bankhi = 0x3f, m.addrlo = 0x2000, m.addrhi = 0x2007;
|
||||
|
@ -22,7 +22,7 @@ void Link::init() {
|
||||
|
||||
void Link::load() {
|
||||
if(opened()) close();
|
||||
string basename = snes_interface->path(Cartridge::Slot::Base, "");
|
||||
string basename = interface->path(Cartridge::Slot::Base, "");
|
||||
string name = program != "" ? program : notdir(basename);
|
||||
string path = dir(basename);
|
||||
if(open(name, path)) {
|
||||
|
@ -50,7 +50,7 @@ void MSU1::init() {
|
||||
|
||||
void MSU1::load() {
|
||||
if(datafile.open()) datafile.close();
|
||||
datafile.open(snes_interface->path(Cartridge::Slot::Base, ".msu"), file::mode_read);
|
||||
datafile.open(interface->path(Cartridge::Slot::Base, ".msu"), file::mode_read);
|
||||
}
|
||||
|
||||
void MSU1::unload() {
|
||||
@ -133,7 +133,7 @@ void MSU1::mmio_write(unsigned addr, uint8 data) {
|
||||
if(addr == 0x2005) {
|
||||
mmio.audio_track = (mmio.audio_track & 0x00ff) | (data << 8);
|
||||
if(audiofile.open()) audiofile.close();
|
||||
if(audiofile.open(snes_interface->path(Cartridge::Slot::Base, string("-", (unsigned)mmio.audio_track, ".pcm")), file::mode_read)) {
|
||||
if(audiofile.open(interface->path(Cartridge::Slot::Base, string("-", (unsigned)mmio.audio_track, ".pcm")), file::mode_read)) {
|
||||
uint32 header = audiofile.readm(4);
|
||||
if(header != 0x4d535531) { //verify 'MSU1' header
|
||||
audiofile.close();
|
||||
|
@ -16,12 +16,12 @@ void MSU1::serialize(serializer &s) {
|
||||
s.integer(mmio.audio_play);
|
||||
|
||||
if(datafile.open()) datafile.close();
|
||||
if(datafile.open(snes_interface->path(Cartridge::Slot::Base, ".msu"), file::mode_read)) {
|
||||
if(datafile.open(interface->path(Cartridge::Slot::Base, ".msu"), file::mode_read)) {
|
||||
datafile.seek(mmio.data_offset);
|
||||
}
|
||||
|
||||
if(audiofile.open()) audiofile.close();
|
||||
if(audiofile.open(snes_interface->path(Cartridge::Slot::Base, string("-", (unsigned)mmio.audio_track, ".pcm")), file::mode_read)) {
|
||||
if(audiofile.open(interface->path(Cartridge::Slot::Base, string("-", (unsigned)mmio.audio_track, ".pcm")), file::mode_read)) {
|
||||
audiofile.seek(mmio.audio_offset);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
uint2 Gamepad::data() {
|
||||
if(counter >= 16) return 1;
|
||||
uint2 result = snes_interface->inputPoll(port, Input::Device::Joypad, 0, counter);
|
||||
uint2 result = interface->inputPoll(port, Input::Device::Joypad, 0, counter);
|
||||
if(latched == 0) counter++;
|
||||
return result;
|
||||
}
|
||||
|
@ -18,16 +18,16 @@ void Justifier::enter() {
|
||||
}
|
||||
|
||||
if(next < prev) {
|
||||
int nx1 = snes_interface->inputPoll(port, Input::Device::Justifier, 0, (unsigned)Input::JustifierID::X);
|
||||
int ny1 = snes_interface->inputPoll(port, Input::Device::Justifier, 0, (unsigned)Input::JustifierID::Y);
|
||||
int nx1 = interface->inputPoll(port, Input::Device::Justifier, 0, (unsigned)Input::JustifierID::X);
|
||||
int ny1 = interface->inputPoll(port, Input::Device::Justifier, 0, (unsigned)Input::JustifierID::Y);
|
||||
nx1 += x1;
|
||||
ny1 += y1;
|
||||
x1 = max(-16, min(256 + 16, nx1));
|
||||
y1 = max(-16, min(240 + 16, ny1));
|
||||
|
||||
if(chained == true) {
|
||||
int nx2 = snes_interface->inputPoll(port, Input::Device::Justifiers, 1, (unsigned)Input::JustifierID::X);
|
||||
int ny2 = snes_interface->inputPoll(port, Input::Device::Justifiers, 1, (unsigned)Input::JustifierID::Y);
|
||||
int nx2 = interface->inputPoll(port, Input::Device::Justifiers, 1, (unsigned)Input::JustifierID::X);
|
||||
int ny2 = interface->inputPoll(port, Input::Device::Justifiers, 1, (unsigned)Input::JustifierID::Y);
|
||||
nx2 += x2;
|
||||
ny2 += y2;
|
||||
x2 = max(-16, min(256 + 16, nx2));
|
||||
@ -48,11 +48,11 @@ uint2 Justifier::data() {
|
||||
if(counter >= 32) return 1;
|
||||
|
||||
if(counter == 0) {
|
||||
trigger1 = snes_interface->inputPoll(port, Input::Device::Justifier, 0, (unsigned)Input::JustifierID::Trigger);
|
||||
start1 = snes_interface->inputPoll(port, Input::Device::Justifier, 0, (unsigned)Input::JustifierID::Start);
|
||||
trigger1 = interface->inputPoll(port, Input::Device::Justifier, 0, (unsigned)Input::JustifierID::Trigger);
|
||||
start1 = interface->inputPoll(port, Input::Device::Justifier, 0, (unsigned)Input::JustifierID::Start);
|
||||
if(chained) {
|
||||
trigger2 = snes_interface->inputPoll(port, Input::Device::Justifiers, 1, (unsigned)Input::JustifierID::Trigger);
|
||||
start2 = snes_interface->inputPoll(port, Input::Device::Justifiers, 1, (unsigned)Input::JustifierID::Start);
|
||||
trigger2 = interface->inputPoll(port, Input::Device::Justifiers, 1, (unsigned)Input::JustifierID::Trigger);
|
||||
start2 = interface->inputPoll(port, Input::Device::Justifiers, 1, (unsigned)Input::JustifierID::Start);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
uint2 Mouse::data() {
|
||||
if(counter >= 32) return 1;
|
||||
|
||||
int position_x = snes_interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
int position_y = snes_interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
int position_x = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::X); //-n = left, 0 = center, +n = right
|
||||
int position_y = interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Y); //-n = up, 0 = center, +n = down
|
||||
|
||||
bool direction_x = position_x < 0; //0 = right, 1 = left
|
||||
bool direction_y = position_y < 0; //0 = down, 1 = up
|
||||
@ -25,8 +25,8 @@ uint2 Mouse::data() {
|
||||
case 6: return 0;
|
||||
case 7: return 0;
|
||||
|
||||
case 8: return snes_interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Right);
|
||||
case 9: return snes_interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Left);
|
||||
case 8: return interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Right);
|
||||
case 9: return interface->inputPoll(port, Input::Device::Mouse, 0, (unsigned)Input::MouseID::Left);
|
||||
case 10: return 0; //speed (0 = slow, 1 = normal, 2 = fast, 3 = unused)
|
||||
case 11: return 0; // ||
|
||||
|
||||
|
@ -18,8 +18,8 @@ uint2 Multitap::data() {
|
||||
port2 = 3; //controller 4
|
||||
}
|
||||
|
||||
bool data1 = snes_interface->inputPoll(port, Input::Device::Multitap, port1, index);
|
||||
bool data2 = snes_interface->inputPoll(port, Input::Device::Multitap, port2, index);
|
||||
bool data1 = interface->inputPoll(port, Input::Device::Multitap, port1, index);
|
||||
bool data2 = interface->inputPoll(port, Input::Device::Multitap, port2, index);
|
||||
return (data2 << 1) | (data1 << 0);
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ void Serial::latch(bool data) {
|
||||
|
||||
Serial::Serial(bool port) : Controller(port) {
|
||||
enable = false;
|
||||
string basename = snes_interface->path(Cartridge::Slot::Base, "");
|
||||
string basename = interface->path(Cartridge::Slot::Base, "");
|
||||
string name = notdir(basename);
|
||||
string path = dir(basename);
|
||||
if(open(name, path)) {
|
||||
|
@ -28,8 +28,8 @@ void SuperScope::enter() {
|
||||
|
||||
if(next < prev) {
|
||||
//Vcounter wrapped back to zero; update cursor coordinates for start of new frame
|
||||
int nx = snes_interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::X);
|
||||
int ny = snes_interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Y);
|
||||
int nx = interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::X);
|
||||
int ny = interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Y);
|
||||
nx += x;
|
||||
ny += y;
|
||||
x = max(-16, min(256 + 16, nx));
|
||||
@ -51,7 +51,7 @@ uint2 SuperScope::data() {
|
||||
|
||||
if(counter == 0) {
|
||||
//turbo is a switch; toggle is edge sensitive
|
||||
bool newturbo = snes_interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Turbo);
|
||||
bool newturbo = interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Turbo);
|
||||
if(newturbo && !turbo) {
|
||||
turbo = !turbo; //toggle state
|
||||
turbolock = true;
|
||||
@ -62,7 +62,7 @@ uint2 SuperScope::data() {
|
||||
//trigger is a button
|
||||
//if turbo is active, trigger is level sensitive; otherwise, it is edge sensitive
|
||||
trigger = false;
|
||||
bool newtrigger = snes_interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Trigger);
|
||||
bool newtrigger = interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Trigger);
|
||||
if(newtrigger && (turbo || !triggerlock)) {
|
||||
trigger = true;
|
||||
triggerlock = true;
|
||||
@ -71,11 +71,11 @@ uint2 SuperScope::data() {
|
||||
}
|
||||
|
||||
//cursor is a button; it is always level sensitive
|
||||
cursor = snes_interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Cursor);
|
||||
cursor = interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Cursor);
|
||||
|
||||
//pause is a button; it is always edge sensitive
|
||||
pause = false;
|
||||
bool newpause = snes_interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Pause);
|
||||
bool newpause = interface->inputPoll(port, Input::Device::SuperScope, 0, (unsigned)Input::SuperScopeID::Pause);
|
||||
if(newpause && !pauselock) {
|
||||
pause = true;
|
||||
pauselock = true;
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace SNES {
|
||||
|
||||
Interface *snes_interface = 0;
|
||||
Interface *interface = 0;
|
||||
|
||||
void Interface::videoRefresh(const uint32_t *data, bool hires, bool interlace, bool overscan) {
|
||||
}
|
||||
@ -15,7 +15,7 @@ int16_t Interface::inputPoll(bool port, Input::Device::e device, unsigned index,
|
||||
}
|
||||
|
||||
void Interface::initialize(Interface *derived_interface) {
|
||||
snes_interface = derived_interface;
|
||||
interface = derived_interface;
|
||||
system.init();
|
||||
}
|
||||
|
||||
|
@ -37,4 +37,4 @@ struct Interface {
|
||||
virtual void message(const string &text);
|
||||
};
|
||||
|
||||
extern Interface *snes_interface;
|
||||
extern Interface *interface;
|
||||
|
@ -81,7 +81,7 @@ void Video::update() {
|
||||
}
|
||||
}
|
||||
|
||||
snes_interface->videoRefresh(ppu.surface, hires, ppu.interlace(), ppu.overscan());
|
||||
interface->videoRefresh(ppu.surface, hires, ppu.interlace(), ppu.overscan());
|
||||
|
||||
hires = false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user