fix lightguns in snes9x, support offscreen shots in snes9x (UI yet to be hooked up), fix lightguns in new bsnes, add option in bsnes to disable drawing light gun cursors (UI yet to be hooked up)

This commit is contained in:
CasualPokePlayer 2023-03-30 16:32:19 -07:00
parent 380e459bec
commit f7b83be5ab
10 changed files with 16 additions and 9 deletions

Binary file not shown.

Binary file not shown.

View File

@ -93,16 +93,16 @@ auto Justifier::latch() -> void {
if(!active) {
int nx = platform->inputPoll(port, device, 0 + X);
int ny = platform->inputPoll(port, device, 0 + Y);
player1.x = max(-16, min(256 + 16, nx + player1.x));
player1.y = max(-16, min((int)ppu.vdisp() + 16, ny + player1.y));
player1.x = max(-16, min(256 + 16, nx));
player1.y = max(-16, min((int)ppu.vdisp() + 16, ny));
bool offscreen = (player1.x < 0 || player1.y < 0 || player1.x >= 256 || player1.y >= (int)ppu.vdisp());
if(!offscreen) ppu.latchCounters(player1.x, player1.y);
}
else {
int nx = platform->inputPoll(port, device, 4 + X);
int ny = platform->inputPoll(port, device, 4 + Y);
player2.x = max(-16, min(256 + 16, nx + player2.x));
player2.y = max(-16, min((int)ppu.vdisp() + 16, ny + player2.y));
player2.x = max(-16, min(256 + 16, nx));
player2.y = max(-16, min((int)ppu.vdisp() + 16, ny));
bool offscreen = (player2.x < 0 || player2.y < 0 || player2.x >= 256 || player2.y >= (int)ppu.vdisp());
if(!offscreen) ppu.latchCounters(player2.x, player2.y);
}

View File

@ -92,8 +92,8 @@ auto SuperScope::latch(bool data) -> void {
auto SuperScope::latch() -> void {
int nx = platform->inputPoll(port, ID::Device::SuperScope, X);
int ny = platform->inputPoll(port, ID::Device::SuperScope, Y);
x = max(-16, min(256 + 16, nx + x));
y = max(-16, min((int)ppu.vdisp() + 16, ny + y));
x = max(-16, min(256 + 16, nx));
y = max(-16, min((int)ppu.vdisp() + 16, ny));
offscreen = (x < 0 || y < 0 || x >= 256 || y >= (int)ppu.vdisp());
if(!offscreen) ppu.latchCounters(x, y);
}

View File

@ -16,6 +16,7 @@ auto Configuration::process(Markup::Node document, bool load) -> void {
bind(boolean, "Video/BlurEmulation", video.blurEmulation);
bind(boolean, "Video/ColorEmulation", video.colorEmulation);
bind(boolean, "Video/DrawCursor", video.drawCursor);
bind(boolean, "Hacks/Hotfixes", hacks.hotfixes);
bind(text, "Hacks/Entropy", hacks.entropy);

View File

@ -25,6 +25,7 @@ struct Configuration {
struct Video {
bool blurEmulation = true;
bool colorEmulation = true;
bool drawCursor = true;
} video;
struct Hacks {

View File

@ -166,7 +166,7 @@ auto PPU::refresh() -> void {
}
}
if(auto device = controllerPort2.device) device->draw(output, pitch * sizeof(uint16), width, height);
if(configuration.video.drawCursor) if(auto device = controllerPort2.device) device->draw(output, pitch * sizeof(uint16), width, height);
platform->videoFrame(output, pitch * sizeof(uint16), width, height, hd() ? hdScale() : 1);
frame.pitch = pitch;

View File

@ -209,7 +209,7 @@ auto PPU::refresh() -> void {
}
}
}
if(auto device = controllerPort2.device) device->draw(output, pitch * sizeof(uint16), width, height);
if(configuration.video.drawCursor) if(auto device = controllerPort2.device) device->draw(output, pitch * sizeof(uint16), width, height);
platform->videoFrame(output, pitch * sizeof(uint16), width, height, /* scale = */ 1);
}

View File

@ -291,6 +291,11 @@ EXPORT void snes_set_overscan_enabled(bool enabled)
program->overscan = enabled;
}
EXPORT void snes_set_cursor_enabled(bool enabled)
{
emulator->configure("Video/DrawCursor", enabled);
}
uint8_t* snes_get_effective_saveram(int* ram_size) {
if (cartridge.has.SA1) {

@ -1 +1 @@
Subproject commit 172f73b7111e50a58aa081fb2ad0fc55f911936f
Subproject commit 1887cd256785fc69646d417ca4956fe03e7c2a87