Vs. System error messages and DIP switch visualization

This commit is contained in:
Alexey 'Cluster' Avdyukhin 2023-01-06 16:50:33 +04:00
parent 2c35a6dfae
commit 598a291daf
1 changed files with 12 additions and 7 deletions

View File

@ -32,15 +32,17 @@
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
static uint8 show_dips = 0; static int DIPS_howlong = 0;
uint8 vsdip = 0; uint8 vsdip = 0;
void FCEUI_VSUniToggleDIPView(void) {
show_dips = !show_dips;
}
void FCEU_VSUniToggleDIP(int w) { void FCEU_VSUniToggleDIP(int w) {
if (GameInfo->type != GIT_VSUNI) {
FCEU_DispMessage("Not Vs. System; toggle DIP switch.", 0);
return;
}
vsdip ^= 1 << w; vsdip ^= 1 << w;
DIPS_howlong = 180;
FCEU_DispMessage("DIP switch %d is %s.", 0, w, vsdip & (1 << w) ? "on" : "off");
} }
void FCEUI_VSUniSetDIP(int w, int state) { void FCEUI_VSUniSetDIP(int w, int state) {
@ -81,6 +83,9 @@ static DECLFR(VSSecRead) {
uint8 coinon = 0; uint8 coinon = 0;
void FCEU_VSUniCoin(void) { void FCEU_VSUniCoin(void) {
if (GameInfo->type != GIT_VSUNI)
FCEU_DispMessage("Not Vs. System; can't insert coin.", 0);
else
coinon = 6; coinon = 6;
} }
@ -369,7 +374,7 @@ void FCEU_VSUniDraw(uint8 *XBuf) {
uint32 *dest; uint32 *dest;
int y, x; int y, x;
if (!show_dips) return; if (DIPS_howlong-- <= 0) return;
dest = (uint32*)(XBuf + 256 * 12 + 164); dest = (uint32*)(XBuf + 256 * 12 + 164);
for (y = 24; y; y--, dest += (256 - 72) >> 2) { for (y = 24; y; y--, dest += (256 - 72) >> 2) {