fix nyma cd switching

also changing the make all cores script so it uses the install target
This commit is contained in:
CasualPokePlayer 2022-05-29 21:16:23 -07:00
parent 43ffb63ede
commit 1c27c73c86
13 changed files with 40 additions and 43 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -104,10 +104,10 @@ enum BizhawkFlags
SkipSoundening = 2,
// render at LCM * LCM instead of raw
RenderConstantSize = 4,
// switch to the previous disk, if possible
PreviousDisk = 8,
// switch to the next disk, if possible
NextDisk = 16
// open disk tray, if possible
OpenTray = 8,
// close disk tray, if possible
CloseTray = 16
};
struct MyFrameInfo: public FrameInfo
@ -118,6 +118,7 @@ struct MyFrameInfo: public FrameInfo
// raw data for each input port, assumed to be MAX_PORTS * MAX_PORT_DATA long
uint8_t* InputPortData;
int64_t FrontendTime;
uint8_t DiscIndex; // used on close tray
};
ECL_EXPORT void FrameAdvance(MyFrameInfo& frame)
@ -127,10 +128,10 @@ ECL_EXPORT void FrameAdvance(MyFrameInfo& frame)
EES->skip = !!(frame.BizhawkFlags & BizhawkFlags::SkipRendering);
{
auto prev = !!(frame.BizhawkFlags & BizhawkFlags::PreviousDisk);
auto next = !!(frame.BizhawkFlags & BizhawkFlags::NextDisk);
if (prev || next)
SwitchCds(prev, next);
auto open = !!(frame.BizhawkFlags & BizhawkFlags::OpenTray);
auto close = !!(frame.BizhawkFlags & BizhawkFlags::CloseTray);
if (open || close)
SwitchCds(open, close, frame.DiscIndex);
}
if (frame.Command)

View File

@ -117,38 +117,34 @@ void StartGameWithCds(int numdisks)
0 // orientation: flip sides on NES FDS. not used elsewhere?
);
}
static bool wasPrev;
static bool wasNext;
static int cd;
void SwitchCds(bool prev, bool next)
static bool trayOpen = false;
static int curCd = 0; // -1 means no media present
void SwitchCds(bool open, bool close, int cd)
{
auto newCd = cd;
if (prev && !wasPrev)
{
newCd = std::max(newCd - 1, -1);
}
if (next && !wasNext)
{
newCd = std::min(newCd + 1, (int)(CDInterfaces->size() - 1));
}
if (newCd != cd)
if (open && !trayOpen)
{
Mednafen::MDFNGameInfo->SetMedia(
0, // drive: 0 unless there's more than one drive
0, // state: 0 = open, 1 = closed (media absent), 2 = closed (media present)
std::max(curCd, 0), // media: index into the disk list
0 // orientation: flip sides on NES FDS. not used elsewhere?
);
trayOpen = true;
}
if (close && trayOpen)
{
Mednafen::MDFNGameInfo->SetMedia(
0, // drive: 0 unless there's more than one drive
cd == -1 ? 1 : 2, // state: 0 = open, 1 = closed (media absent), 2 = closed (media present)
std::max(cd, 0), // media: index into the disk list
0 // orientation: flip sides on NES FDS. not used elsewhere?
);
Mednafen::MDFNGameInfo->SetMedia(
0, // drive: 0 unless there's more than one drive
newCd == -1 ? 0 : 2, // state: 0 = open, 1 = closed (media absent), 2 = closed (media present)
std::max(newCd, 0), // media: index into the disk list
0 // orientation: flip sides on NES FDS. not used elsewhere?
);
trayOpen = false;
curCd = cd;
}
cd = newCd;
wasPrev = prev;
wasNext = next;
}
// CDInterface::Load pulls in a bunch of things that we do not want, stub them out here

View File

@ -11,7 +11,7 @@ ECL_EXPORT void SetCDCallbacks()
{
abort();
}
void SwitchCds(bool prev, bool next)
void SwitchCds(bool open, bool close, int cd)
{
abort();
}

View File

@ -27,4 +27,4 @@ typedef void (*FrameCallback)();
void RegisterFrameThreadProc(FrameCallback threadproc);
void StartGameWithCds(int numdisks);
void SwitchCds(bool prev, bool next);
void SwitchCds(bool open, bool close, int cd);

View File

@ -1,13 +1,13 @@
#!/bin/sh
set -e
make -f turbo.mak $1 -j
make -f hyper.mak $1 -j
make -f ngp.mak $1 -j
make -f faust.mak $1 -j
make -f pcfx.mak $1 -j
make -f ss.mak $1 -j
make -f shock.mak $1 -j
# make -f lynx.mak $1 -j
make -f vb.mak $1 -j
# make -f wswan.mak $1 -j
make -f turbo.mak $1 -j install
make -f hyper.mak $1 -j install
make -f ngp.mak $1 -j install
make -f faust.mak $1 -j install
make -f pcfx.mak $1 -j install
make -f ss.mak $1 -j install
make -f shock.mak $1 -j install
# make -f lynx.mak $1 -j install
make -f vb.mak $1 -j install
# make -f wswan.mak $1 -j install