bsnes/higan/sfc/controller/gamepad/gamepad.cpp

58 lines
1.6 KiB
C++
Raw Normal View History

#ifdef CONTROLLER_CPP
uint2 Gamepad::data() {
if(counter >= 16) return 1;
Update to v090 release. byuu says: Most notably, this release adds Nintendo DS emulation. The Nintendo DS module was written entirely by Cydrak, so please give him all of the credit for it. I for one am extremely grateful to be allowed to use his module in bsnes. The Nintendo DS emulator's standalone name is dasShiny. You will need the Nintendo DS firmware, which I cannot provide, in order to use it. It also cannot (currently?) detect the save type used by NDS games. As such, manifest.xml files must be created manually for this purpose. The long-term plan is to create a database of save types for each game. Also, you will need an analog input device for the touch screen for now (joypad axes work well.) There have also been a lot of changes from my end: a unified manifest.xml format across all systems, major improvements to SPC7110 emulation, enhancements to RTC emulation, MSU1 enhancements, icons in the file browser list, improvements to SNES coprocessor memory mapping, cleanups and improvements in the libraries used to build bsnes, etc. I've also included kaijuu (which allows launching game folders directly with bsnes) and purify (which allows opening images that are compressed, have copier headers, and have wrong extensions); both of which are fully GUI-based. This release only loads game folders, not files. Use purify to load ROM files in bsnes. Note that this will likely be the last release for a long time, and that I will probably rename the emulator for the next release, due to how many additional systems it now supports.
2012-08-07 14:08:37 +00:00
if(latched == 1) return interface->inputPoll(port, (unsigned)Input::Device::Joypad, (unsigned)Input::JoypadID::B);
//note: D-pad physically prevents up+down and left+right from being pressed at the same time
switch(counter++) {
case 0: return b;
case 1: return y;
case 2: return select;
case 3: return start;
case 4: return up & !down;
case 5: return down & !up;
case 6: return left & !right;
case 7: return right & !left;
case 8: return a;
case 9: return x;
case 10: return l;
case 11: return r;
}
return 0; //12-15: signature
}
void Gamepad::latch(bool data) {
if(latched == data) return;
latched = data;
counter = 0;
Update to v090 release. byuu says: Most notably, this release adds Nintendo DS emulation. The Nintendo DS module was written entirely by Cydrak, so please give him all of the credit for it. I for one am extremely grateful to be allowed to use his module in bsnes. The Nintendo DS emulator's standalone name is dasShiny. You will need the Nintendo DS firmware, which I cannot provide, in order to use it. It also cannot (currently?) detect the save type used by NDS games. As such, manifest.xml files must be created manually for this purpose. The long-term plan is to create a database of save types for each game. Also, you will need an analog input device for the touch screen for now (joypad axes work well.) There have also been a lot of changes from my end: a unified manifest.xml format across all systems, major improvements to SPC7110 emulation, enhancements to RTC emulation, MSU1 enhancements, icons in the file browser list, improvements to SNES coprocessor memory mapping, cleanups and improvements in the libraries used to build bsnes, etc. I've also included kaijuu (which allows launching game folders directly with bsnes) and purify (which allows opening images that are compressed, have copier headers, and have wrong extensions); both of which are fully GUI-based. This release only loads game folders, not files. Use purify to load ROM files in bsnes. Note that this will likely be the last release for a long time, and that I will probably rename the emulator for the next release, due to how many additional systems it now supports.
2012-08-07 14:08:37 +00:00
if(latched == 0) {
unsigned id = (unsigned)Input::Device::Joypad;
b = interface->inputPoll(port, id, 0);
y = interface->inputPoll(port, id, 1);
select = interface->inputPoll(port, id, 2);
start = interface->inputPoll(port, id, 3);
up = interface->inputPoll(port, id, 4);
down = interface->inputPoll(port, id, 5);
left = interface->inputPoll(port, id, 6);
right = interface->inputPoll(port, id, 7);
a = interface->inputPoll(port, id, 8);
x = interface->inputPoll(port, id, 9);
l = interface->inputPoll(port, id, 10);
r = interface->inputPoll(port, id, 11);
}
}
Gamepad::Gamepad(bool port) : Controller(port) {
latched = 0;
counter = 0;
Update to v090 release. byuu says: Most notably, this release adds Nintendo DS emulation. The Nintendo DS module was written entirely by Cydrak, so please give him all of the credit for it. I for one am extremely grateful to be allowed to use his module in bsnes. The Nintendo DS emulator's standalone name is dasShiny. You will need the Nintendo DS firmware, which I cannot provide, in order to use it. It also cannot (currently?) detect the save type used by NDS games. As such, manifest.xml files must be created manually for this purpose. The long-term plan is to create a database of save types for each game. Also, you will need an analog input device for the touch screen for now (joypad axes work well.) There have also been a lot of changes from my end: a unified manifest.xml format across all systems, major improvements to SPC7110 emulation, enhancements to RTC emulation, MSU1 enhancements, icons in the file browser list, improvements to SNES coprocessor memory mapping, cleanups and improvements in the libraries used to build bsnes, etc. I've also included kaijuu (which allows launching game folders directly with bsnes) and purify (which allows opening images that are compressed, have copier headers, and have wrong extensions); both of which are fully GUI-based. This release only loads game folders, not files. Use purify to load ROM files in bsnes. Note that this will likely be the last release for a long time, and that I will probably rename the emulator for the next release, due to how many additional systems it now supports.
2012-08-07 14:08:37 +00:00
b = y = select = start = 0;
up = down = left = right = 0;
a = x = l = r = 0;
}
#endif